-
Notifications
You must be signed in to change notification settings - Fork 0
/
bach_test.ts
75 lines (64 loc) · 1.49 KB
/
bach_test.ts
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import * as assert from "@eeue56/ts-assert";
import { centerAndPadding } from "./bach";
export function testShort() {
assert.strictEqual(2, 1 + 1);
}
export function testBasicAddition() {
assert.strictEqual(2, 1 + 1);
}
export function testEvenCenterAndPadding() {
assert.deepStrictEqual(centerAndPadding(8, "true"), " true ");
}
export function testOddCenterAndPadding() {
assert.deepStrictEqual(centerAndPadding(8, "false"), " false ");
}
export function testObjectEquality() {
const user = {
name: "noah",
age: 28,
pets: [
{
name: "burt",
},
],
};
const otherInstanceOfUser = {
name: "noah",
age: 28,
pets: [
{
name: "burt",
},
],
};
assert.deepStrictEqual(user, otherInstanceOfUser);
}
export async function testAsyncFunctions() {
return new Promise((resolve, reject) => {
setTimeout(() => {
try {
assert.strictEqual("hello", "hello");
} catch (e) {
return reject(e);
}
resolve(null);
}, 300);
});
}
export async function snapshotString() {
return "Hello world!";
}
export async function snapshotNumber() {
return 9001;
}
export async function snapshotObject() {
return {
name: "Noah",
age: 30,
pets: [
{
name: "Frodo",
},
],
};
}