clone

a browser grid puzzle game where you push words around to rewrite the rules of each level

Give Core its authored world identity

Dami committed e02efa1
commit
e02efa12a5ab63ea22221df64660738818d67bdc
parent
f82ad3dccd56d4d91c8fae52afd15801b6cb3b6b
author
Dami <dami.etoile@gmail.com>
2 files changed, +27 -3
Msrc/catalog.js10+++++++++-
Mtests/catalog.test.js20++++++++++++++++++--
M src/catalog.js +9 -1
M tests/catalog.test.js +18 -2
@@ -14,8 +14,11 @@ const level = (title, id) => ({ id, title, width: 2, height: 1, objects: [
1414 1515 test('starts with stable core pack and preserves additive import order', () => {1616 const catalog = createCatalog({ coreLevels: [level('Core', 'intro')] });17- assert.equal(catalog.getPack('core').manifest.rules, 2);18- assert.deepEqual(catalog.getPacks()[0].world, { glyph: null, tagline: null, accent: null });17+ const core = catalog.getPack('core');18+ assert.equal(core.manifest.rules, 2);19+ assert.equal(core.manifest.author, 'Miau Is True');20+ assert.deepEqual(core.manifest.world, { glyph: '🐈', tagline: 'Where the rules first bend.', accent: 'you' });21+ assert.deepEqual(catalog.getPacks()[0].world, core.manifest.world);1922 assert.deepEqual(catalog.getPacks().map(pack => pack.id), ['core']);2023 catalog.importMod(pack('alpha', 'Alpha', [level('A one', 'start'), level('A two', 'next')]));2124 catalog.importMod(pack('beta', 'Beta', [level('B one', 'start')]));
@@ -25,6 +28,19 @@ test('starts with stable core pack and preserves additive import order', () => {
2528 assert.equal(catalog.getLevel('alpha:start').origin, 'local');2629 });2730 31+test('core world identity remains effective through catalog normalization', () => {32+ const catalog = createCatalog({ coreLevels: [level('Core', 'intro')] });33+ const [core] = catalog.getPacks();34+ assert.equal(core.id, 'core');35+ assert.equal(core.manifest.author, 'Miau Is True');36+ assert.deepEqual(core.world, {37+ glyph: '🐈',38+ tagline: 'Where the rules first bend.',39+ accent: 'you',40+ });41+ assert.deepEqual(core.worldWarnings, []);42+});43+2844 test('invalid world identity falls back without losing authored pack data', () => {2945 const catalog = createCatalog({ coreLevels: [level('Core', 'intro')] });3046 const source = pack('world-bad', 'World Bad', [level('Proof', 'intro')]);