Skip to content

Commit b018c34

Browse files
committed
fix: file path
1 parent 2ddf563 commit b018c34

12 files changed

+26
-29
lines changed

.github/workflows/build.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ jobs:
3535
- name: Test & Build
3636
run: |
3737
pnpm build
38-
pnpm run test:code:gen
3938
pnpm test
4039
env:
4140
CI: true

test/__tests__/argo-rollout-test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import * as fs from "fs";
2-
import * as path from "path";
32

43
import * as Utils from "../utils";
54

65
describe("Argo Rollout", () => {
76
test("client.ts", () => {
8-
const generateCode = fs.readFileSync(path.join(__dirname, "../code/argo-rollout/client.ts"), { encoding: "utf-8" });
7+
const generateCode = fs.readFileSync("test/code/argo-rollout/client.ts", { encoding: "utf-8" });
98
const text = Utils.replaceVersionInfo(generateCode);
109
expect(text).toMatchSnapshot();
1110
});

test/__tests__/client-generate-test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ import type * as Types from "../../src/types";
77

88
describe("raw-json-generate", () => {
99
test("the raw json input result and the json file path result are same", () => {
10-
const generateCode = JSON.parse(fs.readFileSync(path.join(__dirname, "../kubernetes/openapi-v1.18.5.json"), { encoding: "utf-8" }));
10+
const generateCode = JSON.parse(fs.readFileSync("test/kubernetes/openapi-v1.18.5.json", { encoding: "utf-8" }));
1111

1212
const codeGenerator1 = new CodeGenerator(generateCode);
13-
const codeGenerator2 = new CodeGenerator(path.join(__dirname, "../kubernetes/openapi-v1.18.5.json"));
13+
const codeGenerator2 = new CodeGenerator("test/kubernetes/openapi-v1.18.5.json");
1414

1515
const apiClientGeneratorTemplate: Types.CodeGenerator.CustomGenerator<Templates.ApiClient.Option> = {
1616
generator: Templates.ApiClient.generator,
@@ -30,7 +30,7 @@ describe("raw-json-generate", () => {
3030
expect(code1).toBe(code2);
3131
});
3232
test("yaml file path loadable", () => {
33-
const codeGenerator = new CodeGenerator(path.join(__dirname, "../api.test.domain/index.yml"));
33+
const codeGenerator = new CodeGenerator("test/api.test.domain/index.yml");
3434

3535
const apiClientGeneratorTemplate: Types.CodeGenerator.CustomGenerator<Templates.ApiClient.Option> = {
3636
generator: Templates.ApiClient.generator,

test/__tests__/format.domain.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import * as fs from "fs";
2-
import * as path from "path";
32

43
import * as Utils from "../utils";
54

65
describe("Format Types", () => {
76
test("format.domain", () => {
8-
const generateCode = fs.readFileSync(path.join(__dirname, "../code/format.domain/code.ts"), { encoding: "utf-8" });
7+
const generateCode = fs.readFileSync("test/code/format.domain/code.ts", { encoding: "utf-8" });
98
const text = Utils.replaceVersionInfo(generateCode);
109
expect(text).toMatchSnapshot();
1110
});

test/__tests__/kubernetes-test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import * as fs from "fs";
2-
import * as path from "path";
32

43
import * as Utils from "../utils";
54

65
describe("Kubernetes", () => {
76
test("client-v1.18.5.ts", () => {
8-
const generateCode = fs.readFileSync(path.join(__dirname, "../code/kubernetes/client-v1.18.5.ts"), { encoding: "utf-8" });
7+
const generateCode = fs.readFileSync("test/code/kubernetes/client-v1.18.5.ts", { encoding: "utf-8" });
98
const text = Utils.replaceVersionInfo(generateCode);
109
expect(text).toMatchSnapshot();
1110
});

test/__tests__/multi-type.test.domain.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ import * as Utils from "../utils";
55

66
describe("Multi Type", () => {
77
test("types", () => {
8-
const generateCode = fs.readFileSync(path.join(__dirname, "../code/mulit-type-test.domain/types.ts"), { encoding: "utf-8" });
8+
const generateCode = fs.readFileSync("test/code/mulit-type-test.domain/types.ts", { encoding: "utf-8" });
99
const text = Utils.replaceVersionInfo(generateCode);
1010
expect(text).toMatchSnapshot();
1111
});
1212

1313
test("apiClient", () => {
14-
const generateCode = fs.readFileSync(path.join(__dirname, "../code/mulit-type-test.domain/apiClient.ts"), { encoding: "utf-8" });
14+
const generateCode = fs.readFileSync("test/code/mulit-type-test.domain/apiClient.ts", { encoding: "utf-8" });
1515
const text = Utils.replaceVersionInfo(generateCode);
1616
expect(text).toMatchSnapshot();
1717
});

test/__tests__/parameter-test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ import * as Utils from "../utils";
55

66
describe("Parameter", () => {
77
test("api.test.domain", () => {
8-
const generateCode = fs.readFileSync(path.join(__dirname, "../code/parameter/api.test.domain.json"), { encoding: "utf-8" });
8+
const generateCode = fs.readFileSync("test/code/parameter/api.test.domain.json", { encoding: "utf-8" });
99
const text = Utils.replaceVersionInfo(generateCode);
1010
expect(text).toMatchSnapshot();
1111
});
1212
test("infer.domain", () => {
13-
const generateCode = fs.readFileSync(path.join(__dirname, "../code/parameter/infer.domain.json"), { encoding: "utf-8" });
13+
const generateCode = fs.readFileSync("test/code/parameter/infer.domain.json", { encoding: "utf-8" });
1414
const text = Utils.replaceVersionInfo(generateCode);
1515
expect(text).toMatchSnapshot();
1616
});

test/__tests__/spit-code-test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ import * as Utils from "../utils";
55

66
describe("Split Code", () => {
77
test("types", () => {
8-
const generateCode = fs.readFileSync(path.join(__dirname, "../code/split/types.ts"), { encoding: "utf-8" });
8+
const generateCode = fs.readFileSync("test/code/split/types.ts", { encoding: "utf-8" });
99
const text = Utils.replaceVersionInfo(generateCode);
1010
expect(text).toMatchSnapshot();
1111
});
1212

1313
test("apiClient", () => {
14-
const generateCode = fs.readFileSync(path.join(__dirname, "../code/split/apiClient.ts"), { encoding: "utf-8" });
14+
const generateCode = fs.readFileSync("test/code/split/apiClient.ts", { encoding: "utf-8" });
1515
const text = Utils.replaceVersionInfo(generateCode);
1616
expect(text).toMatchSnapshot();
1717
});

test/__tests__/template-only-test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ import * as Utils from "../utils";
55

66
describe("Template Only", () => {
77
test("api.test.domain", () => {
8-
const generateCode = fs.readFileSync(path.join(__dirname, "../code/template-only/api.test.domain.ts"), { encoding: "utf-8" });
8+
const generateCode = fs.readFileSync("test/code/template-only/api.test.domain.ts", { encoding: "utf-8" });
99
const text = Utils.replaceVersionInfo(generateCode);
1010
expect(text).toMatchSnapshot();
1111
});
1212
test("async-api.test.domain", () => {
13-
const generateCode = fs.readFileSync(path.join(__dirname, "../code/template-only/sync-api.test.domain.ts"), { encoding: "utf-8" });
13+
const generateCode = fs.readFileSync("test/code/template-only/sync-api.test.domain.ts", { encoding: "utf-8" });
1414
const text = Utils.replaceVersionInfo(generateCode);
1515
expect(text).toMatchSnapshot();
1616
});
1717
test("infer.domain", () => {
18-
const generateCode = fs.readFileSync(path.join(__dirname, "../code/template-only/infer.domain.ts"), { encoding: "utf-8" });
18+
const generateCode = fs.readFileSync("test/code/template-only/infer.domain.ts", { encoding: "utf-8" });
1919
const text = Utils.replaceVersionInfo(generateCode);
2020
expect(text).toMatchSnapshot();
2121
});

test/__tests__/typedef-only-test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ import * as Utils from "../utils";
55

66
describe("Typedef only", () => {
77
test("typedef-api.test.domain", () => {
8-
const generateCode = fs.readFileSync(path.join(__dirname, "../code/typedef-only/api.test.domain.ts"), { encoding: "utf-8" });
8+
const generateCode = fs.readFileSync("test/code/typedef-only/api.test.domain.ts", { encoding: "utf-8" });
99
const text = Utils.replaceVersionInfo(generateCode);
1010
expect(text).toMatchSnapshot();
1111
});
1212
test("typedef-infer.domain", () => {
13-
const generateCode = fs.readFileSync(path.join(__dirname, "../code/typedef-only/infer.domain.ts"), { encoding: "utf-8" });
13+
const generateCode = fs.readFileSync("test/code/typedef-only/infer.domain.ts", { encoding: "utf-8" });
1414
const text = Utils.replaceVersionInfo(generateCode);
1515
expect(text).toMatchSnapshot();
1616
});

test/__tests__/typedef-with-template-test.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,37 @@
11
import * as fs from "fs";
2-
import * as path from "path";
32

43
import * as Utils from "../utils";
54

65
describe("Typedef with template", () => {
76
test("api.test.domain", () => {
8-
const generateCode = fs.readFileSync(path.join(__dirname, "../code/typedef-with-template/api.test.domain.ts"), { encoding: "utf-8" });
7+
const generateCode = fs.readFileSync("test/code/typedef-with-template/api.test.domain.ts", { encoding: "utf-8" });
98
const text = Utils.replaceVersionInfo(generateCode);
109
expect(text).toMatchSnapshot();
1110
});
1211
test("api.v2.domain", () => {
13-
const generateCode = fs.readFileSync(path.join(__dirname, "../code/typedef-with-template/api.v2.domain.ts"), { encoding: "utf-8" });
12+
const generateCode = fs.readFileSync("test/code/typedef-with-template/api.v2.domain.ts", { encoding: "utf-8" });
1413
const text = Utils.replaceVersionInfo(generateCode);
1514
expect(text).toMatchSnapshot();
1615
});
1716
test("async-api.test.domain", () => {
18-
const generateCode = fs.readFileSync(path.join(__dirname, "../code/typedef-with-template/sync-api.test.domain.ts"), { encoding: "utf-8" });
17+
const generateCode = fs.readFileSync("test/code/typedef-with-template/sync-api.test.domain.ts", {
18+
encoding: "utf-8",
19+
});
1920
const text = Utils.replaceVersionInfo(generateCode);
2021
expect(text).toMatchSnapshot();
2122
});
2223
test("infer.domain", () => {
23-
const generateCode = fs.readFileSync(path.join(__dirname, "../code/typedef-with-template/infer.domain.ts"), { encoding: "utf-8" });
24+
const generateCode = fs.readFileSync("test/code/typedef-with-template/infer.domain.ts", { encoding: "utf-8" });
2425
const text = Utils.replaceVersionInfo(generateCode);
2526
expect(text).toMatchSnapshot();
2627
});
2728
test("ref-access", () => {
28-
const generateCode = fs.readFileSync(path.join(__dirname, "../code/typedef-with-template/ref-access.ts"), { encoding: "utf-8" });
29+
const generateCode = fs.readFileSync("test/code/typedef-with-template/ref-access.ts", { encoding: "utf-8" });
2930
const text = Utils.replaceVersionInfo(generateCode);
3031
expect(text).toMatchSnapshot();
3132
});
3233
test("remote-ref-access", () => {
33-
const generateCode = fs.readFileSync(path.join(__dirname, "../code/typedef-with-template/remote-ref-access.ts"), { encoding: "utf-8" });
34+
const generateCode = fs.readFileSync("test/code/typedef-with-template/remote-ref-access.ts", { encoding: "utf-8" });
3435
const text = Utils.replaceVersionInfo(generateCode);
3536
expect(text).toMatchSnapshot();
3637
});

test/__tests__/unknown-schema-domain-test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import * as Utils from "../utils";
55

66
describe("Unknown", () => {
77
test("client.ts", () => {
8-
const generateCode = fs.readFileSync(path.join(__dirname, "../code/unknown.schema.domain/client.ts"), { encoding: "utf-8" });
8+
const generateCode = fs.readFileSync("test/code/unknown.schema.domain/client.ts", { encoding: "utf-8" });
99
const text = Utils.replaceVersionInfo(generateCode);
1010
expect(text).toMatchSnapshot();
1111
});

0 commit comments

Comments
 (0)