Require spec/suite property keys to be strings, not just anything that's cloneable and serializable

This matches the jsdoc.
This commit is contained in:
Steve Gravrock
2025-10-18 17:22:48 -07:00
parent d66d0d9d2e
commit 4201fd848f
5 changed files with 32 additions and 22 deletions
+3 -15
View File
@@ -103,26 +103,14 @@ describe('Spec', function() {
});
});
it('throws if the key is not structured-cloneable', function() {
it('throws if the key is not a string', function() {
const spec = new privateUnderTest.Spec({
queueableFn: { fn: () => {} }
});
expect(function() {
spec.setSpecProperty(new Promise(() => {}), '');
}).toThrowError("Key can't be cloned");
});
it('throws if the key is not JSON-serializable', function() {
const spec = new privateUnderTest.Spec({
queueableFn: { fn: () => {} }
});
expect(function() {
const k = {};
k.self = k;
spec.setSpecProperty(k, '');
}).toThrowError("Key can't be cloned");
spec.setSpecProperty({}, '');
}).toThrowError('Key must be a string');
});
it('throws if the value is not structured-cloneable', function() {