-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathci.test.ts
69 lines (63 loc) · 1.34 KB
/
ci.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
import { Act, Mockapi } from "@kie/act-js";
import { MockGithub } from "@kie/mock-github";
import path from "path";
let github: MockGithub;
beforeEach(async () => {
github = new MockGithub({
repo: {
mockApi: {
files: [
{
src: path.resolve(__dirname, "..", ".github"),
dest: ".github",
}
],
},
},
});
await github.setup();
});
afterEach(async () => {
await github.teardown();
});
test("api workflow", async () => {
const mockapi = new Mockapi({
google: {
baseUrl: "http://google.com",
endpoints: {
root: {
get: {
path: "/",
method: "get",
parameters: {
query: [],
path: [],
body: [],
},
},
},
},
},
});
const act = new Act(github.repo.getPath("mockApi"));
const result = await act.runEvent("push", {
logFile: process.env.ACT_LOG ? "mock-api.log" : undefined,
mockApi: [
mockapi.mock.google.root
.get()
.setResponse({ status: 200, data: "mock response" }),
],
});
expect(result).toMatchObject([
{
name: "Main actions/checkout@v3",
status: 0,
output: "",
},
{
name: "Main api call",
status: 0,
output: "mock response",
}
]);
});