bfbaeae67f
* Fix #5867 * Add test. * Add tests to clipboard.test.ts Co-authored-by: Aakansha Doshi <aakansha1216@gmail.com>
28 lines
552 B
TypeScript
28 lines
552 B
TypeScript
import { parseClipboard } from "./clipboard";
|
|
|
|
describe("Test parseClipboard", () => {
|
|
it("should parse valid json correctly", async () => {
|
|
let text = "123";
|
|
|
|
let clipboardData = await parseClipboard({
|
|
//@ts-ignore
|
|
clipboardData: {
|
|
getData: () => text,
|
|
},
|
|
});
|
|
|
|
expect(clipboardData.text).toBe(text);
|
|
|
|
text = "[123]";
|
|
|
|
clipboardData = await parseClipboard({
|
|
//@ts-ignore
|
|
clipboardData: {
|
|
getData: () => text,
|
|
},
|
|
});
|
|
|
|
expect(clipboardData.text).toBe(text);
|
|
});
|
|
});
|