Skip to content

Commit

Permalink
core(test): Add whimsical and figma tests
Browse files Browse the repository at this point in the history
  • Loading branch information
thooams committed Oct 12, 2024
1 parent f61dbf3 commit e2e4ca1
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions test/services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -463,3 +463,30 @@ describe('Miro service', () => {
})
});

describe('whimsical', () => {
it('should correctly parse URL got from a browser', () => {
const regularBoardUrl = 'https://whimsical.com/test-86ajy7vWEzYATvwFFvbwfA';
const event = composePasteEventMock('pattern', 'whimsical', regularBoardUrl);

embed.onPaste(event);

expect(patterns.whimsical.test(regularBoardUrl)).to.be.true;
expect(embed.data.service).to.be.equal('whimsical');
expect(embed.data.embed).to.be.equal('https://whimsical.com/embed/86ajy7vWEzYATvwFFvbwfA');
expect(embed.data.source).to.be.equal(regularBoardUrl);
});
});

describe('figma', () => {
it('should correctly parse URL got from a browser', () => {
const regularBoardUrl = 'https://www.figma.com/file/3BYrViWFPvfhbrpm1aO3ha/Untitled?type=design&node-id=0%3A1&mode=design&t=WutMRT9L8VJNEL5z-1';
const event = composePasteEventMock('pattern', 'figma', regularBoardUrl);

embed.onPaste(event);

expect(patterns.figma.test(regularBoardUrl)).to.be.true;
expect(embed.data.service).to.be.equal('figma');
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');
expect(embed.data.source).to.be.equal(regularBoardUrl);
});
});

0 comments on commit e2e4ca1

Please sign in to comment.