mirror: A fast canonicalisation utility for stable object equality
0

Configure Feed

Select the types of activity you want to include in your feed.

chore: correct some tests

Marais Rossouw (Jun 24, 2026, 1:00 PM +1000) c5df2261 c990f156

+7 -9
+7 -9
lib/mod.test.ts
··· 17 17 assertEquals(identify([1, 2, 3]), identify([1, 2, 3])); 18 18 }); 19 19 20 - Deno.test.ignore('arrays :: order is insignificant', () => { 21 - assertEquals(identify([3, 2, 1]), identify([1, 2, 3])); 20 + Deno.test('arrays :: order is significant', () => { 21 + assertNotEquals(identify([3, 2, 1]), identify([1, 2, 3])); 22 22 }); 23 23 24 24 Deno.test('arrays :: nested', () => { ··· 89 89 assertEquals(identify(a), identify(a)); 90 90 }); 91 91 92 - // TODO: Right now they do match, because the o1 lookup is the same as o2 93 - // as the reference is still the same, so the weakmap is the same 92 + // Known limitation: cycle detection keys off object reference identity, so two 93 + // structurally-different cyclic shapes that share a referenced node can collapse 94 + // to the same identity. Left ignored until the circular-handling overhaul. 94 95 Deno.test.ignore('objects :: with samey circular should not match', () => { 95 96 const o1: any = { a: 1, b: 2 }; 96 97 const o2: any = { a: 1, b: 2 }; ··· 116 117 assertEquals(identify({ a: 'b' }), identify(new Map([['a', 'b']]))); 117 118 }); 118 119 119 - Deno.test.ignore('sets :: order is insignificant', () => { 120 + Deno.test('sets :: order is significant', () => { 120 121 assertNotEquals( 121 122 identify(new Set([1, 2, 3])), 122 123 identify(new Set([3, 2, 1])), 123 124 ); 124 125 }); 125 126 126 - Deno.test.ignore('sets :: order is insignificant for object members', () => { 127 + Deno.test('sets :: order is significant for object members', () => { 127 128 assertNotEquals( 128 129 identify(new Set([{ a: 'a' }, { b: 'b' }])), 129 130 identify(new Set([{ b: 'b' }, { a: 'a' }])), ··· 183 184 t(123); 184 185 t(null); 185 186 t(undefined); 186 - // TODO: Solve for symbols 187 - // t(Symbol()); 188 - // t(Symbol("test")); 189 187 }); 190 188 191 189 Deno.test('values :: throws on unsupported builtins', () => {