Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
janicduplessis committed Oct 31, 2023
1 parent 846fe18 commit c5828fb
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/unit/onyxCacheTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,18 @@ describe('Onyx', () => {
expect(() => cache.merge(0)).toThrow();
expect(() => cache.merge({})).not.toThrow();
});

it('Should merge `null` values', () => {
// `null` values can override existing values and should also
// be preserved during merges.
cache.set('mockKey', {ID: 5});
cache.set('mockNullKey', null);

cache.merge({mockKey: null});

expect(cache.getValue('mockKey')).toEqual(null);
expect(cache.getValue('mockNullKey')).toEqual(null);
});
});

describe('hasPendingTask', () => {
Expand Down

0 comments on commit c5828fb

Please sign in to comment.