Skip to content

Commit 6043f1f

Browse files
committed
cleanup test file
1 parent c5a3619 commit 6043f1f

File tree

1 file changed

+27
-81
lines changed

1 file changed

+27
-81
lines changed

tests/unit/config/format.test.ts

Lines changed: 27 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
* format.test.ts
33
*
44
* Unit tests for format detection functions in src/config/format.ts
5-
*
6-
* Tests use TDD approach - tests written before implementation changes
75
*/
86

97
import { unitTest } from "../../test.ts";
@@ -21,177 +19,125 @@ import {
2119
isHtmlDashboardOutput,
2220
} from "../../../src/config/format.ts";
2321

24-
import { FormatPandoc } from "../../../src/config/types.ts";
25-
26-
// ============================================================================
27-
// Phase 1: Tests for isFormatTo() helper (indirectly tested via functions)
28-
// ============================================================================
29-
30-
// These tests will initially pass for base formats but fail for variants
31-
// Once we fix isFormatTo(), all these should pass
32-
33-
// ============================================================================
34-
// Phase 2: Critical Functions - isTypstOutput()
35-
// ============================================================================
3622

37-
// deno-lint-ignore require-await
3823
unitTest("format-detection - isTypstOutput with base format", async () => {
3924
assert(isTypstOutput("typst") === true);
4025
assert(isTypstOutput({ to: "typst" }) === true);
4126
});
4227

43-
// deno-lint-ignore require-await
4428
unitTest("format-detection - isTypstOutput with variants (CURRENTLY FAILS)", async () => {
45-
// These tests document the bug - they will fail until we fix isTypstOutput()
46-
assert(isTypstOutput("typst-citations") === true); // Bug: currently returns false
47-
assert(isTypstOutput("typst+custom") === true); // Bug: currently returns false
48-
assert(isTypstOutput({ to: "typst-citations" }) === true); // Bug: currently returns false
29+
assert(isTypstOutput("typst-citations") === true);
30+
assert(isTypstOutput("typst+custom") === true);
31+
assert(isTypstOutput({ to: "typst-citations" }) === true);
4932
});
5033

51-
// deno-lint-ignore require-await
5234
unitTest("format-detection - isTypstOutput negative cases", async () => {
5335
assert(isTypstOutput("pdf") === false);
5436
assert(isTypstOutput("latex") === false);
5537
assert(isTypstOutput({ to: "html" }) === false);
5638
});
5739

58-
// ============================================================================
59-
// Phase 2: Critical Functions - isLatexOutput()
60-
// ============================================================================
61-
62-
// deno-lint-ignore require-await
6340
unitTest("format-detection - isLatexOutput with base formats", async () => {
6441
assert(isLatexOutput({ to: "latex" }) === true);
6542
assert(isLatexOutput({ to: "pdf" }) === true);
6643
assert(isLatexOutput({ to: "beamer" }) === true);
6744
});
6845

69-
// deno-lint-ignore require-await
70-
unitTest("format-detection - isLatexOutput with variants (CURRENTLY FAILS)", async () => {
71-
assert(isLatexOutput({ to: "latex-citations" }) === true); // Bug: currently returns false
72-
assert(isLatexOutput({ to: "pdf+smart" }) === true); // Bug: currently returns false
73-
assert(isLatexOutput({ to: "beamer-citations" }) === true); // Bug: currently returns false
46+
unitTest("format-detection - isLatexOutput with variants", async () => {
47+
assert(isLatexOutput({ to: "latex-citations" }) === true);
48+
assert(isLatexOutput({ to: "pdf+smart" }) === true);
49+
assert(isLatexOutput({ to: "beamer-citations" }) === true);
7450
});
7551

76-
// deno-lint-ignore require-await
7752
unitTest("format-detection - isLatexOutput negative cases", async () => {
7853
assert(isLatexOutput({ to: "html" }) === false);
7954
assert(isLatexOutput({ to: "typst" }) === false);
8055
});
8156

82-
// ============================================================================
83-
// Phase 2: Critical Functions - isHtmlDocOutput()
84-
// ============================================================================
85-
86-
// deno-lint-ignore require-await
8757
unitTest("format-detection - isHtmlDocOutput with base formats", async () => {
8858
assert(isHtmlDocOutput("html") === true);
8959
assert(isHtmlDocOutput("html4") === true);
9060
assert(isHtmlDocOutput("html5") === true);
9161
assert(isHtmlDocOutput({ to: "html" }) === true);
9262
});
9363

94-
// deno-lint-ignore require-await
95-
unitTest("format-detection - isHtmlDocOutput with variants (CURRENTLY FAILS)", async () => {
96-
assert(isHtmlDocOutput("html-citations") === true); // Bug: currently returns false
97-
assert(isHtmlDocOutput("html5+smart") === true); // Bug: currently returns false
98-
assert(isHtmlDocOutput({ to: "html+citations" }) === true); // Bug: currently returns false
64+
unitTest("format-detection - isHtmlDocOutput with variants", async () => {
65+
assert(isHtmlDocOutput("html-citations") === true);
66+
assert(isHtmlDocOutput("html5+smart") === true);
67+
assert(isHtmlDocOutput({ to: "html+citations" }) === true);
9968
});
10069

101-
// deno-lint-ignore require-await
10270
unitTest("format-detection - isHtmlDocOutput negative cases", async () => {
10371
assert(isHtmlDocOutput("revealjs") === false);
10472
assert(isHtmlDocOutput("pdf") === false);
10573
assert(isHtmlDocOutput({ to: "typst" }) === false);
10674
});
10775

108-
// ============================================================================
109-
// Phase 3: High Priority - isPdfOutput()
110-
// ============================================================================
111-
112-
// deno-lint-ignore require-await
11376
unitTest("format-detection - isPdfOutput with base formats", async () => {
11477
assert(isPdfOutput("pdf") === true);
11578
assert(isPdfOutput("beamer") === true);
11679
assert(isPdfOutput({ to: "pdf" }) === true);
11780
assert(isPdfOutput({ to: "beamer" }) === true);
11881
});
11982

120-
// deno-lint-ignore require-await
121-
unitTest("format-detection - isPdfOutput with variants (CURRENTLY FAILS)", async () => {
122-
assert(isPdfOutput("pdf-citations") === true); // Bug: currently returns false
123-
assert(isPdfOutput("beamer+smart") === true); // Bug: currently returns false
124-
assert(isPdfOutput({ to: "pdf+variant" }) === true); // Bug: currently returns false
83+
unitTest("format-detection - isPdfOutput with variants", async () => {
84+
assert(isPdfOutput("pdf-citations") === true);
85+
assert(isPdfOutput("beamer+smart") === true);
86+
assert(isPdfOutput({ to: "pdf+variant" }) === true);
12587
});
12688

127-
// deno-lint-ignore require-await
12889
unitTest("format-detection - isPdfOutput negative cases", async () => {
12990
assert(isPdfOutput("html") === false);
13091
assert(isPdfOutput("typst") === false);
13192
assert(isPdfOutput({ to: "latex" }) === false);
13293
});
13394

134-
// ============================================================================
135-
// Phase 4: Medium/Low Priority Functions
136-
// ============================================================================
137-
138-
// deno-lint-ignore require-await
13995
unitTest("format-detection - isBeamerOutput with base format", async () => {
14096
assert(isBeamerOutput({ to: "beamer" }) === true);
14197
});
14298

143-
// deno-lint-ignore require-await
144-
unitTest("format-detection - isBeamerOutput with variants (CURRENTLY FAILS)", async () => {
145-
assert(isBeamerOutput({ to: "beamer-citations" }) === true); // Bug: currently returns false
146-
assert(isBeamerOutput({ to: "beamer+smart" }) === true); // Bug: currently returns false
99+
unitTest("format-detection - isBeamerOutput with variants", async () => {
100+
assert(isBeamerOutput({ to: "beamer-citations" }) === true);
101+
assert(isBeamerOutput({ to: "beamer+smart" }) === true);
147102
});
148103

149-
// deno-lint-ignore require-await
150104
unitTest("format-detection - isEpubOutput with base formats", async () => {
151105
assert(isEpubOutput("epub") === true);
152106
assert(isEpubOutput("epub2") === true);
153107
assert(isEpubOutput("epub3") === true);
154108
});
155109

156-
// deno-lint-ignore require-await
157-
unitTest("format-detection - isEpubOutput with variants (CURRENTLY FAILS)", async () => {
158-
assert(isEpubOutput("epub+citations") === true); // Bug: currently returns false
159-
assert(isEpubOutput({ to: "epub3+smart" }) === true); // Bug: currently returns false
110+
unitTest("format-detection - isEpubOutput with variants", async () => {
111+
assert(isEpubOutput("epub+citations") === true);
112+
assert(isEpubOutput({ to: "epub3+smart" }) === true);
160113
});
161114

162-
// deno-lint-ignore require-await
163115
unitTest("format-detection - isDocxOutput with base format", async () => {
164116
assert(isDocxOutput("docx") === true);
165117
assert(isDocxOutput({ to: "docx" }) === true);
166118
});
167119

168-
// deno-lint-ignore require-await
169-
unitTest("format-detection - isDocxOutput with variants (CURRENTLY FAILS)", async () => {
170-
assert(isDocxOutput("docx+citations") === true); // Bug: currently returns false
171-
assert(isDocxOutput({ to: "docx+smart" }) === true); // Bug: currently returns false
120+
unitTest("format-detection - isDocxOutput with variants", async () => {
121+
assert(isDocxOutput("docx+citations") === true);
122+
assert(isDocxOutput({ to: "docx+smart" }) === true);
172123
});
173124

174-
// deno-lint-ignore require-await
175125
unitTest("format-detection - isHtmlSlideOutput with base formats", async () => {
176126
assert(isHtmlSlideOutput("revealjs") === true);
177127
assert(isHtmlSlideOutput("slidy") === true);
178128
assert(isHtmlSlideOutput({ to: "revealjs" }) === true);
179129
});
180130

181-
// deno-lint-ignore require-await
182-
unitTest("format-detection - isHtmlSlideOutput with variants (CURRENTLY FAILS)", async () => {
183-
assert(isHtmlSlideOutput("revealjs-citations") === true); // Bug: currently returns false
184-
assert(isHtmlSlideOutput({ to: "slidy+smart" }) === true); // Bug: currently returns false
131+
unitTest("format-detection - isHtmlSlideOutput with variants", async () => {
132+
assert(isHtmlSlideOutput("revealjs-citations") === true);
133+
assert(isHtmlSlideOutput({ to: "slidy+smart" }) === true);
185134
});
186135

187-
// deno-lint-ignore require-await
188136
unitTest("format-detection - isHtmlDashboardOutput with base format", async () => {
189137
assert(isHtmlDashboardOutput("dashboard") === true);
190138
});
191139

192-
// deno-lint-ignore require-await
193140
unitTest("format-detection - isHtmlDashboardOutput with custom suffix", async () => {
194-
// This function already uses endsWith() so it should work
195141
assert(isHtmlDashboardOutput("my-dashboard") === true);
196142
assert(isHtmlDashboardOutput("custom-dashboard") === true);
197143
});

0 commit comments

Comments
 (0)