Skip to content

Commit 5683fab

Browse files
authored
Merge pull request #66 from nut-tree/develop
Closes #64
2 parents 6933425 + 6f44544 commit 5683fab

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { ClipboardAction } from "./clipboardy-clipboard-action.class";
2+
3+
beforeEach(() => {
4+
jest.resetAllMocks();
5+
});
6+
7+
describe("clipboardy action", () => {
8+
describe("copy", () => {
9+
it("should resolve", async done => {
10+
// GIVEN
11+
const SUT = new ClipboardAction();
12+
const testText = "test";
13+
14+
// WHEN
15+
16+
// THEN
17+
await SUT.copy(testText);
18+
done();
19+
});
20+
});
21+
describe("hasText", () => {
22+
it("should return true when text has been copied", async done => {
23+
// GIVEN
24+
const SUT = new ClipboardAction();
25+
const testText = "test";
26+
27+
// WHEN
28+
await SUT.copy(testText);
29+
30+
// THEN
31+
await expect(SUT.hasText()).resolves.toBeTruthy();
32+
done();
33+
});
34+
});
35+
});

Diff for: lib/provider/native/clipboardy-clipboard-action.class.ts

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export class ClipboardAction implements ClipboardActionProvider {
2424
return new Promise<void>((resolve, reject) => {
2525
try {
2626
clippy.writeSync(text);
27+
resolve();
2728
} catch (e) {
2829
reject(e);
2930
}

0 commit comments

Comments
 (0)