|
1 | 1 | import * as fs from "fs";
|
2 |
| -import { posix as path } from "path"; |
3 | 2 |
|
4 | 3 | import * as Utils from "../utils";
|
5 | 4 |
|
6 | 5 | describe("Typedef with template", () => {
|
7 | 6 | test("api.test.domain", () => {
|
8 |
| - const generateCode = fs.readFileSync(path.resolve(__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" }); |
9 | 8 | const text = Utils.replaceVersionInfo(generateCode);
|
10 | 9 | expect(text).toMatchSnapshot();
|
11 | 10 | });
|
12 | 11 | test("api.v2.domain", () => {
|
13 |
| - const generateCode = fs.readFileSync(path.resolve(__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" }); |
14 | 13 | const text = Utils.replaceVersionInfo(generateCode);
|
15 | 14 | expect(text).toMatchSnapshot();
|
16 | 15 | });
|
17 | 16 | test("async-api.test.domain", () => {
|
18 |
| - const filepath = path.resolve(__dirname, "../code/typedef-with-template/sync-api.test.domain.ts"); |
19 |
| - console.log({ filepath }); |
20 |
| - const generateCode = fs.readFileSync(filepath, { |
| 17 | + const generateCode = fs.readFileSync("test/code/typedef-with-template/sync-api.test.domain.ts", { |
21 | 18 | encoding: "utf-8",
|
22 | 19 | });
|
23 | 20 | const text = Utils.replaceVersionInfo(generateCode);
|
24 | 21 | expect(text).toMatchSnapshot();
|
25 | 22 | });
|
26 | 23 | test("infer.domain", () => {
|
27 |
| - const generateCode = fs.readFileSync(path.resolve(__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" }); |
28 | 25 | const text = Utils.replaceVersionInfo(generateCode);
|
29 | 26 | expect(text).toMatchSnapshot();
|
30 | 27 | });
|
31 | 28 | test("ref-access", () => {
|
32 |
| - const generateCode = fs.readFileSync(path.resolve(__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" }); |
33 | 30 | const text = Utils.replaceVersionInfo(generateCode);
|
34 | 31 | expect(text).toMatchSnapshot();
|
35 | 32 | });
|
36 | 33 | test("remote-ref-access", () => {
|
37 |
| - const generateCode = fs.readFileSync(path.resolve(__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" }); |
38 | 35 | const text = Utils.replaceVersionInfo(generateCode);
|
39 | 36 | expect(text).toMatchSnapshot();
|
40 | 37 | });
|
|
0 commit comments