diff options
Diffstat (limited to 'src/world/lattice.test.js')
-rw-r--r-- | src/world/lattice.test.js | 61 |
1 files changed, 32 insertions, 29 deletions
diff --git a/src/world/lattice.test.js b/src/world/lattice.test.js index c2fdb6b..d1bdd13 100644 --- a/src/world/lattice.test.js +++ b/src/world/lattice.test.js @@ -77,32 +77,35 @@ test("check proposals agains lattice for validity", () => { }); -test("proposals update cell flags appropriately", () => { - const lattice = [ - [ - { type: 'empty', flags: { step: 1} }, - { type: 'empty', flags: {} }, - { type: 'plant', flags: { foo: 'bar' } }, - ] - ]; - - // flags are reset each time step - expect(lattice_apply(lattice, [{ world_updates:[{ x: 1, y: 0, from: 'empty', to: 'plant' }]}])).toEqual([[ - { type: 'empty', flags: {} }, - { type: 'plant', flags: {} }, - { type: 'plant', flags: {} }, - ]]); - - // flags are combined when updating - expect(lattice_apply(lattice, [ - { world_updates: [{ x: 1, y: 0, flags: { foo: 'bar' } } ]}, - { world_updates: [{ x: 1, y: 0, from: 'empty', to: 'plant', flags: { baz: 'baz' } } ]}, - { world_updates: [{ x: 0, y: 0, from: 'empty', to: 'plant', flags: { foo: 'foo' } } ]}, - { world_updates: [{ x: 0, y: 0, flags: { beep: 'boop' } } ]}, - ])).toEqual([[ - { type: 'plant', flags: { foo: 'foo', beep: 'boop' } }, - { type: 'plant', flags: { foo: 'bar', baz: 'baz' } }, - { type: 'plant', flags: {} }, - ]]); - -}); +// this test is no longer relevant because resetting the cell flags is taken care of by world_update, +// not lattice_apply +// +//test("proposals update cell flags appropriately", () => { +// const lattice = [ +// [ +// { type: 'empty', flags: { step: 1} }, +// { type: 'empty', flags: {} }, +// { type: 'plant', flags: { foo: 'bar' } }, +// ] +// ]; +// +// // flags are reset each time step +// expect(lattice_apply(lattice, [{ world_updates:[{ x: 1, y: 0, from: 'empty', to: 'plant' }]}])).toEqual([[ +// { type: 'empty', flags: {} }, +// { type: 'plant', flags: {} }, +// { type: 'plant', flags: {} }, +// ]]); +// +// // flags are combined when updating +// expect(lattice_apply(lattice, [ +// { world_updates: [{ x: 1, y: 0, flags: { foo: 'bar' } } ]}, +// { world_updates: [{ x: 1, y: 0, from: 'empty', to: 'plant', flags: { baz: 'baz' } } ]}, +// { world_updates: [{ x: 0, y: 0, from: 'empty', to: 'plant', flags: { foo: 'foo' } } ]}, +// { world_updates: [{ x: 0, y: 0, flags: { beep: 'boop' } } ]}, +// ])).toEqual([[ +// { type: 'plant', flags: { foo: 'foo', beep: 'boop' } }, +// { type: 'plant', flags: { foo: 'bar', baz: 'baz' } }, +// { type: 'plant', flags: {} }, +// ]]); +// +//}); |