Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
33 lines
1.1 KiB
JavaScript
33 lines
1.1 KiB
JavaScript
import { test } from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import { makeTempMonorepo, makeGameProject, cleanup } from './helpers.mjs';
|
|
import { checkVersions } from '../check-cocos-version.mjs';
|
|
|
|
test('checkVersions 全部一致时 mismatches 为空', () => {
|
|
const mono = makeTempMonorepo();
|
|
try {
|
|
makeGameProject(mono.games, 'a', '3.8.8');
|
|
makeGameProject(mono.games, 'b', '3.8.8');
|
|
const r = checkVersions(mono.host, mono.games);
|
|
assert.equal(r.expected, '3.8.8');
|
|
assert.deepEqual(r.mismatches, []);
|
|
} finally {
|
|
cleanup(mono.root);
|
|
}
|
|
});
|
|
|
|
test('checkVersions 报告与宿主不一致的工程', () => {
|
|
const mono = makeTempMonorepo();
|
|
try {
|
|
makeGameProject(mono.games, 'a', '3.8.8');
|
|
makeGameProject(mono.games, 'b', '3.8.6');
|
|
const r = checkVersions(mono.host, mono.games);
|
|
assert.equal(r.mismatches.length, 1);
|
|
assert.match(r.mismatches[0].project, /[\\/]b$/);
|
|
assert.equal(r.mismatches[0].version, '3.8.6');
|
|
assert.equal(r.mismatches[0].expected, '3.8.8');
|
|
} finally {
|
|
cleanup(mono.root);
|
|
}
|
|
});
|