Skip to content

Commit 3da8a80

Browse files
committed
Update index.spec.ts
1 parent c872804 commit 3da8a80

1 file changed

Lines changed: 18 additions & 18 deletions

File tree

src/index.spec.ts

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { vitest, beforeEach, afterEach, it, describe, expect } from "vitest";
2-
import fs from "fs";
2+
import fs from "fs/promises";
33
import path from "path";
44
import { unified } from "unified";
55
import markdown from "remark-parse";
@@ -62,23 +62,23 @@ describe("e2e", () => {
6262
}
6363

6464
it("article", async () => {
65-
const md = fs.readFileSync(path.join(fixturesDir, "article.md"));
65+
const md = await fs.readFile(path.join(fixturesDir, "article.md"));
6666
const doc = await processor().process(md);
6767
for await (const xml of readDocx(await doc.result)) {
6868
expect(xml).toMatchSnapshot();
6969
}
7070
});
7171

7272
it("break", async () => {
73-
const md = fs.readFileSync(path.join(fixturesDir, "break.md"));
73+
const md = await fs.readFile(path.join(fixturesDir, "break.md"));
7474
const doc = await processor().process(md);
7575
for await (const xml of readDocx(await doc.result)) {
7676
expect(xml).toMatchSnapshot();
7777
}
7878
});
7979

8080
it("code", async () => {
81-
const md = fs.readFileSync(path.join(fixturesDir, "code.md"));
81+
const md = await fs.readFile(path.join(fixturesDir, "code.md"));
8282
const doc = await processor({
8383
plugins: [shikiPlugin({ theme: "dark-plus" })],
8484
}).process(md);
@@ -88,39 +88,39 @@ describe("e2e", () => {
8888
});
8989

9090
it("footnotes", async () => {
91-
const md = fs.readFileSync(path.join(fixturesDir, "footnotes.md"));
91+
const md = await fs.readFile(path.join(fixturesDir, "footnotes.md"));
9292
const doc = await processor().process(md);
9393
for await (const xml of readDocx(await doc.result)) {
9494
expect(xml).toMatchSnapshot();
9595
}
9696
});
9797

9898
it("footnotes2", async () => {
99-
const md = fs.readFileSync(path.join(fixturesDir, "footnotes2.md"));
99+
const md = await fs.readFile(path.join(fixturesDir, "footnotes2.md"));
100100
const doc = await processor().process(md);
101101
for await (const xml of readDocx(await doc.result)) {
102102
expect(xml).toMatchSnapshot();
103103
}
104104
});
105105

106106
it("frontmatter", async () => {
107-
const md = fs.readFileSync(path.join(fixturesDir, "frontmatter.md"));
107+
const md = await fs.readFile(path.join(fixturesDir, "frontmatter.md"));
108108
const doc = await processor().process(md);
109109
for await (const xml of readDocx(await doc.result)) {
110110
expect(xml).toMatchSnapshot();
111111
}
112112
});
113113

114114
it("heading", async () => {
115-
const md = fs.readFileSync(path.join(fixturesDir, "heading.md"));
115+
const md = await fs.readFile(path.join(fixturesDir, "heading.md"));
116116
const doc = await processor().process(md);
117117
for await (const xml of readDocx(await doc.result)) {
118118
expect(xml).toMatchSnapshot();
119119
}
120120
});
121121

122122
it("reference", async () => {
123-
const md = fs.readFileSync(path.join(fixturesDir, "reference.md"));
123+
const md = await fs.readFile(path.join(fixturesDir, "reference.md"));
124124
const doc = await processor({
125125
plugins: [imagePlugin({ load: dummyImage })],
126126
}).process(md);
@@ -130,63 +130,63 @@ describe("e2e", () => {
130130
});
131131

132132
it("list bullet", async () => {
133-
const md = fs.readFileSync(path.join(fixturesDir, "list-bullet.md"));
133+
const md = await fs.readFile(path.join(fixturesDir, "list-bullet.md"));
134134
const doc = await processor().process(md);
135135
for await (const xml of readDocx(await doc.result)) {
136136
expect(xml).toMatchSnapshot();
137137
}
138138
});
139139

140140
it("list ordered", async () => {
141-
const md = fs.readFileSync(path.join(fixturesDir, "list-ordered.md"));
141+
const md = await fs.readFile(path.join(fixturesDir, "list-ordered.md"));
142142
const doc = await processor().process(md);
143143
for await (const xml of readDocx(await doc.result)) {
144144
expect(xml).toMatchSnapshot();
145145
}
146146
});
147147

148148
it("list task", async () => {
149-
const md = fs.readFileSync(path.join(fixturesDir, "list-task.md"));
149+
const md = await fs.readFile(path.join(fixturesDir, "list-task.md"));
150150
const doc = await processor().process(md);
151151
for await (const xml of readDocx(await doc.result)) {
152152
expect(xml).toMatchSnapshot();
153153
}
154154
});
155155

156156
it("math", async () => {
157-
const md = fs.readFileSync(path.join(fixturesDir, "math.md"));
157+
const md = await fs.readFile(path.join(fixturesDir, "math.md"));
158158
const doc = await processor({ plugins: [latexPlugin()] }).process(md);
159159
for await (const xml of readDocx(await doc.result)) {
160160
expect(xml).toMatchSnapshot();
161161
}
162162
});
163163

164164
it("latex", async () => {
165-
const md = fs.readFileSync(path.join(fixturesDir, "latex.md"));
165+
const md = await fs.readFile(path.join(fixturesDir, "latex.md"));
166166
const doc = await processor({ plugins: [latexPlugin()] }).process(md);
167167
for await (const xml of readDocx(await doc.result)) {
168168
expect(xml).toMatchSnapshot();
169169
}
170170
});
171171

172172
it("tag", async () => {
173-
const md = fs.readFileSync(path.join(fixturesDir, "tag.md"));
173+
const md = await fs.readFile(path.join(fixturesDir, "tag.md"));
174174
const doc = await processor({ plugins: [htmlPlugin()] }).process(md);
175175
for await (const xml of readDocx(await doc.result)) {
176176
expect(xml).toMatchSnapshot();
177177
}
178178
});
179179

180180
it("paragraph", async () => {
181-
const md = fs.readFileSync(path.join(fixturesDir, "paragraph.md"));
181+
const md = await fs.readFile(path.join(fixturesDir, "paragraph.md"));
182182
const doc = await processor().process(md);
183183
for await (const xml of readDocx(await doc.result)) {
184184
expect(xml).toMatchSnapshot();
185185
}
186186
});
187187

188188
it("decoration", async () => {
189-
const md = fs.readFileSync(path.join(fixturesDir, "decoration.md"));
189+
const md = await fs.readFile(path.join(fixturesDir, "decoration.md"));
190190
const doc = await processor({
191191
plugins: [imagePlugin({ load: dummyImage })],
192192
}).process(md);
@@ -196,7 +196,7 @@ describe("e2e", () => {
196196
});
197197

198198
it("alt", async () => {
199-
const md = fs.readFileSync(path.join(fixturesDir, "alt.md"));
199+
const md = await fs.readFile(path.join(fixturesDir, "alt.md"));
200200
const doc = await processor({
201201
plugins: [imagePlugin({ load: dummyImage })],
202202
}).process(md);

0 commit comments

Comments
 (0)