From 173faf2174d207a695ab4670bf5ff3431887efea Mon Sep 17 00:00:00 2001 From: Jan Macku Date: Thu, 20 Oct 2022 10:39:02 +0200 Subject: [PATCH] test: Improve coverage of `metadata.ts` --- test/unit/metadata.test.ts | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/test/unit/metadata.test.ts b/test/unit/metadata.test.ts index 372bd56..dfa68a9 100644 --- a/test/unit/metadata.test.ts +++ b/test/unit/metadata.test.ts @@ -14,27 +14,32 @@ describe('Metadata Object', () => { it('can be instantiated', context => context.metadata.map(metadataItem => expect(metadataItem).toBeDefined())); - it.todo( - 'is invalid' /*, async context => { - context.invalid.map(async item => - expect(Metadata.validate(item)).resolves.toMatchSnapshot() - ); - }*/ - ); + it.todo('is invalid'); test('get tag()', context => context.metadata.map(metadataItem => expect(metadataItem.tag).toMatchSnapshot() )); - test.todo('set tag()'); + test('set tag()', context => + context.metadata.map(metadataItem => { + metadataItem.tag = 'newTag-aaa'; + expect(metadataItem.tag).toEqual('newTag-aaa'); + })); test('get commentID()', context => context.metadata.map(metadataItem => expect(metadataItem.commentID).toMatchSnapshot() )); - test.todo('set commentID()'); + test('set commentID()', context => + context.metadata.map(metadataItem => { + const originalID = metadataItem.commentID; + const hadID = originalID == undefined ? false : true; + + metadataItem.commentID = '42'; + expect(metadataItem.commentID).toEqual(hadID ? originalID : '42'); + })); test.todo('getMetadata()'); test.todo('setMetadata()');