Skip to content

Commit b7936ba

Browse files
committed
test: - Show that resetting global LinkResolver affects existing Links
1 parent 5ac3ac6 commit b7936ba

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tests/Task/LinkResolver.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,16 @@ describe('LinkResolver', () => {
4444
const link2 = new Link(rawLink, link_in_file_body.filePath);
4545
expect(link2.destinationPath).toBeNull();
4646
});
47+
48+
it('resetting global instance affects pre-existing links', () => {
49+
const globalInstance = LinkResolver.getInstance();
50+
globalInstance.setGetFirstLinkpathDestFn(() => 'From Global Instance.md');
51+
52+
const link1 = new Link(rawLink, link_in_file_body.filePath);
53+
expect(link1.destinationPath).toEqual('From Global Instance.md');
54+
55+
globalInstance.resetGetFirstLinkpathDestFn();
56+
57+
expect(link1.destinationPath).toBeNull();
58+
});
4759
});

0 commit comments

Comments
 (0)