Also require setSpecProperty/setSuiteProperty args to be JSON serializable

This commit is contained in:
Steve Gravrock
2025-09-27 15:40:19 -07:00
parent c2ce55580c
commit e11f320df3
5 changed files with 42 additions and 12 deletions

View File

@@ -113,6 +113,18 @@ describe('Spec', function() {
}).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");
});
it('throws if the value is not structured-cloneable', function() {
const spec = new privateUnderTest.Spec({
queueableFn: { fn: () => {} }
@@ -122,6 +134,18 @@ describe('Spec', function() {
spec.setSpecProperty('k', new Promise(() => {}));
}).toThrowError("Value can't be cloned");
});
it('throws if the value is not JSON-serializable', function() {
const spec = new privateUnderTest.Spec({
queueableFn: { fn: () => {} }
});
expect(function() {
const v = {};
v.self = v;
spec.setSpecProperty('k', v);
}).toThrowError("Value can't be cloned");
});
});
describe('status', function() {