Skip to content

Commit 6091caf

Browse files
committed
Refactor test and snapshots to colocate next to source file
1 parent 869bd21 commit 6091caf

File tree

10 files changed

+59
-59
lines changed

10 files changed

+59
-59
lines changed

tests/errors.test.ts renamed to scripts/builder.test.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import { stub } from "@std/testing/mock";
22
import { assert, assertRejects } from "@std/assert";
33
import { sandbox } from "@lambdalisue/sandbox";
4-
import { testPaletteSource } from "./utils.ts";
5-
import base from "../scripts/targets/base/base.config.ts";
6-
import { build } from "../scripts/builder.ts";
4+
5+
import { testPaletteSource } from "../tests/utils.ts";
6+
import base from "./targets/base/base.config.ts";
7+
import { build } from "./builder.ts";
78

89
Deno.test("should abort and clean up if Deno.remove throws unexpect error", async () => {
910
const errorMessage = "some Deno.remove error";

tests/__snapshots__/base.test.ts.snap renamed to scripts/targets/base/__snapshots__/base.test.ts.snap

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,20 @@ snapshot[`index.js 1`] = `
1313
'
1414
`;
1515

16+
snapshot[`index.d.ts 1`] = `
17+
"declare namespace _default {
18+
let red: {
19+
50: string;
20+
500: string;
21+
};
22+
let orange: {
23+
100: string;
24+
};
25+
}
26+
export default _default;
27+
"
28+
`;
29+
1630
snapshot[`index.cjs 1`] = `
1731
'"use strict";
1832
module.exports = {
@@ -27,17 +41,3 @@ module.exports = {
2741
Object.defineProperty(exports, "__esModule", { value: true });
2842
'
2943
`;
30-
31-
snapshot[`index.d.ts 1`] = `
32-
"declare namespace _default {
33-
let red: {
34-
50: string;
35-
500: string;
36-
};
37-
let orange: {
38-
100: string;
39-
};
40-
}
41-
export default _default;
42-
"
43-
`;

scripts/targets/base/base.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { expectBuildToMatchSnapshot } from "../../../tests/utils.ts";
2+
import base from "./base.config.ts";
3+
4+
Deno.test("build base target", async (t) => {
5+
await expectBuildToMatchSnapshot(t, base);
6+
});

scripts/targets/css/css.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { expectBuildToMatchSnapshot } from "../../../tests/utils.ts";
2+
import css from "./css.config.ts";
3+
4+
Deno.test("build css target", async (t) => {
5+
await expectBuildToMatchSnapshot(t, css);
6+
});

tests/__snapshots__/tailwind.test.ts.snap renamed to scripts/targets/tailwind/__snapshots__/tailwind.test.ts.snap

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,29 @@ snapshot[`index.css 1`] = `
1616
"
1717
`;
1818

19+
snapshot[`index.cjs 1`] = `
20+
'"use strict";
21+
22+
module.exports = {
23+
inherit: "inherit",
24+
current: "currentColor",
25+
transparent: "transparent",
26+
black: "#000",
27+
white: "#fff",
28+
29+
red: {
30+
50: "oklch(0.988281 0.0046875 20 / <alpha-value>)",
31+
500: "oklch(0.742188 0.151562 20 / <alpha-value>)",
32+
},
33+
orange: {
34+
100: "oklch(0.966797 0.0171875 43.3333 / <alpha-value>)",
35+
},
36+
};
37+
38+
Object.defineProperty(exports, "__esModule", { value: true });
39+
'
40+
`;
41+
1942
snapshot[`index.d.ts 1`] = `
2043
"declare namespace _default {
2144
let inherit: string;
@@ -54,26 +77,3 @@ snapshot[`index.js 1`] = `
5477
};
5578
'
5679
`;
57-
58-
snapshot[`index.cjs 1`] = `
59-
'"use strict";
60-
61-
module.exports = {
62-
inherit: "inherit",
63-
current: "currentColor",
64-
transparent: "transparent",
65-
black: "#000",
66-
white: "#fff",
67-
68-
red: {
69-
50: "oklch(0.988281 0.0046875 20 / <alpha-value>)",
70-
500: "oklch(0.742188 0.151562 20 / <alpha-value>)",
71-
},
72-
orange: {
73-
100: "oklch(0.966797 0.0171875 43.3333 / <alpha-value>)",
74-
},
75-
};
76-
77-
Object.defineProperty(exports, "__esModule", { value: true });
78-
'
79-
`;
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { expectBuildToMatchSnapshot } from "../../../tests/utils.ts";
2+
import tailwind from "./tailwind.config.ts";
3+
4+
Deno.test("build tailwind target", async (t) => {
5+
await expectBuildToMatchSnapshot(t, tailwind);
6+
});

tests/base.test.ts

Lines changed: 0 additions & 7 deletions
This file was deleted.

tests/css.test.ts

Lines changed: 0 additions & 6 deletions
This file was deleted.

tests/tailwind.test.ts

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)