import assert from 'assert'; import { isSafeKey } from './safeKey'; describe('isSafeKey', () => { it('accepts ordinary and dotted keys', () => { for (const key of ['name', 'group.name', 'a.b.c', 'constructors', 'prototypes', 'proto']) { assert.strictEqual(isSafeKey(key), true, key); } }); it('rejects prototype path segments', () => { for (const key of ['__proto__', 'a.__proto__', '__proto__.x', 'constructor', 'a.constructor.b', 'prototype']) { assert.strictEqual(isSafeKey(key), false, key); } }); });