feat(getSpecProperty) get a user-defined property

This commit is contained in:
kbon
2025-08-25 23:00:06 -04:00
parent db65c3b131
commit f822ffea21
5 changed files with 102 additions and 2 deletions

View File

@@ -78,6 +78,17 @@ describe('Spec', function() {
});
});
describe('#getSpecProperty', function() {
it('get the property value', function() {
const spec = new jasmineUnderTest.Spec({
queueableFn: { fn: () => {} }
});
spec.setSpecProperty('a', 4);
expect(spec.getSpecProperty('a')).toBe(4);
});
});
describe('#setSpecProperty', function() {
it('adds the property to the result', function() {
const spec = new jasmineUnderTest.Spec({
@@ -88,6 +99,21 @@ describe('Spec', function() {
expect(spec.result.properties).toEqual({ a: 4 });
});
it('replace the property result when it was previously set', function() {
const spec = new jasmineUnderTest.Spec({
queueableFn: { fn: () => {} }
});
spec.setSpecProperty('a', 'original-value');
spec.setSpecProperty('b', 'original-value');
spec.setSpecProperty('a', 'new-value');
expect(spec.result.properties).toEqual({
a: 'new-value',
b: 'original-value'
});
});
});
it('#status returns passing by default', function() {