-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshared_test.ts
More file actions
52 lines (46 loc) · 1.34 KB
/
Copy pathshared_test.ts
File metadata and controls
52 lines (46 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import { assertEquals } from "./dev_deps.ts"
export function assertOutputCallHave(
fakeStdOut: sinon.SinonStub<[text: string], void>,
call: number,
match: string | RegExp,
) {
// be careful, colours modify the expectation!
assertEquals(
fakeStdOut.getCall(call).args[0].match(match)?.length,
1,
fakeStdOut.getCall(call).args[0],
)
}
export function assertOutputCalls(
fakeStdOut: sinon.SinonStub<[text: string], void>,
expected: number,
) {
assertEquals(fakeStdOut.getCalls().length, expected, "wrong output.")
}
export function assertInsertCalls(
fakeInsert: sinon.SinonStub<[content: string, filename: string], void>,
expected: number,
) {
assertEquals(fakeInsert.getCalls().length, expected, "wrong insert.")
}
export function assertFilesCalls(
fakeFile: sinon.SinonStub<[full_path: string, content: string], void>,
expected: number,
) {
assertEquals(fakeFile.getCalls().length, expected, "wrong files.")
}
export function assertDirectoriesCalls(
fakeDir: sinon.SinonStub<[name: string], void>,
expected: number,
) {
assertEquals(fakeDir.getCalls().length, expected, "wrong directories.")
}
export function assertBlockCalls(
fakeBlock: sinon.SinonStub<
[name: string, insert?: boolean | undefined],
void
>,
expected: number,
) {
assertEquals(fakeBlock.getCalls().length, expected, "wrong block.")
}