Skip to content

Commit e2e4ca1

Browse files
committed
core(test): Add whimsical and figma tests
1 parent f61dbf3 commit e2e4ca1

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

test/services.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,3 +463,30 @@ describe('Miro service', () => {
463463
})
464464
});
465465

466+
describe('whimsical', () => {
467+
it('should correctly parse URL got from a browser', () => {
468+
const regularBoardUrl = 'https://whimsical.com/test-86ajy7vWEzYATvwFFvbwfA';
469+
const event = composePasteEventMock('pattern', 'whimsical', regularBoardUrl);
470+
471+
embed.onPaste(event);
472+
473+
expect(patterns.whimsical.test(regularBoardUrl)).to.be.true;
474+
expect(embed.data.service).to.be.equal('whimsical');
475+
expect(embed.data.embed).to.be.equal('https://whimsical.com/embed/86ajy7vWEzYATvwFFvbwfA');
476+
expect(embed.data.source).to.be.equal(regularBoardUrl);
477+
});
478+
});
479+
480+
describe('figma', () => {
481+
it('should correctly parse URL got from a browser', () => {
482+
const regularBoardUrl = 'https://www.figma.com/file/3BYrViWFPvfhbrpm1aO3ha/Untitled?type=design&node-id=0%3A1&mode=design&t=WutMRT9L8VJNEL5z-1';
483+
const event = composePasteEventMock('pattern', 'figma', regularBoardUrl);
484+
485+
embed.onPaste(event);
486+
487+
expect(patterns.figma.test(regularBoardUrl)).to.be.true;
488+
expect(embed.data.service).to.be.equal('figma');
489+
expect(embed.data.embed).to.be.equal('https://www.figma.com/embed?embed_host=share&url=https://www.figma.com/file/3BYrViWFPvfhbrpm1aO3ha/Untitled?type=design&node-id=0%3A1&mode=design&t=WutMRT9L8VJNEL5z-1');
490+
expect(embed.data.source).to.be.equal(regularBoardUrl);
491+
});
492+
});

0 commit comments

Comments
 (0)