Skip to content

Commit

Permalink
test: Improve coverage of metadata.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
jamacku committed Oct 27, 2022
1 parent 924eee1 commit 173faf2
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions test/unit/metadata.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,32 @@ describe('Metadata Object', () => {
it<IMetadataTestContext>('can be instantiated', context =>
context.metadata.map(metadataItem => expect(metadataItem).toBeDefined()));

it.todo<IMetadataTestContext>(
'is invalid' /*, async context => {
context.invalid.map(async item =>
expect(Metadata.validate(item)).resolves.toMatchSnapshot()
);
}*/
);
it.todo<IMetadataTestContext>('is invalid');

test<IMetadataTestContext>('get tag()', context =>
context.metadata.map(metadataItem =>
expect(metadataItem.tag).toMatchSnapshot()
));

test.todo<IMetadataTestContext>('set tag()');
test<IMetadataTestContext>('set tag()', context =>
context.metadata.map(metadataItem => {
metadataItem.tag = 'newTag-aaa';
expect(metadataItem.tag).toEqual('newTag-aaa');
}));

test<IMetadataTestContext>('get commentID()', context =>
context.metadata.map(metadataItem =>
expect(metadataItem.commentID).toMatchSnapshot()
));

test.todo<IMetadataTestContext>('set commentID()');
test<IMetadataTestContext>('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<IMetadataTestContext>('getMetadata()');
test.todo<IMetadataTestContext>('setMetadata()');
Expand Down

0 comments on commit 173faf2

Please sign in to comment.