Skip to content

Commit 9729225

Browse files
authored
Merge pull request #2570 from UltimateHackingKeyboard/test-serializer-matcher
test: serialize and deserialize object before compare in test-serializer
2 parents ac0c8fa + c488f4f commit 9729225

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

packages/test-serializer/spec/test-serializer.spec.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ describe('Test Serializer', () => {
1717
console.log();
1818
const config2Ts = new UserConfiguration().fromBinary(config1Buffer);
1919
console.log('\n');
20-
const config2Js = config2Ts.toJsonObject();
20+
// Serialize and de-serialize the user config to drop the undefined values
21+
// otherwise jasmine toEqual matcher will complain
22+
const config2Js = JSON.parse(JSON.stringify(config2Ts.toJsonObject()));
2123
const config2Buffer = new UhkBuffer();
2224
config2Ts.toBinary(config2Buffer);
2325
fs.writeFileSync('user-config-serialized.json', JSON.stringify(config2Js, undefined, 4));
@@ -33,7 +35,9 @@ describe('Test Serializer', () => {
3335

3436
it('check json serializer', () => {
3537
const config1Ts: UserConfiguration = new UserConfiguration().fromJsonObject(userConfig);
36-
const jsonObject = config1Ts.toJsonObject();
38+
// Serialize and de-serialize the user config to drop the undefined values
39+
// otherwise jasmine toEqual matcher will complain
40+
const jsonObject = JSON.parse(JSON.stringify(config1Ts.toJsonObject()));
3741

3842
expect(jsonObject).toEqual(userConfig);
3943
});

0 commit comments

Comments
 (0)