Skip to content

Commit 05da2ac

Browse files
committed
fix test warnings
1 parent 1e168c7 commit 05da2ac

File tree

11 files changed

+23
-23
lines changed

11 files changed

+23
-23
lines changed

packages/content/src/__tests__/content-integration.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import path from "node:path";
1+
import path from "node:path/posix";
22
import { createMockLogger } from "@bluecadet/launchpad-testing/test-utils.ts";
33
import { vol } from "memfs";
44
import { http, HttpResponse } from "msw";

packages/content/src/__tests__/launchpad-content.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import path from "node:path";
1+
import path from "node:path/posix";
22
import { createMockLogger } from "@bluecadet/launchpad-testing/test-utils.ts";
33
import { vol } from "memfs";
44
import { afterEach, describe, expect, it, vi } from "vitest";

packages/content/src/plugins/__tests__/md-to-html.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ describe("mdToHtml plugin", () => {
7171
await namespace.insert("doc1", Promise.resolve({ content: { foo: "bar" } }));
7272

7373
const plugin = mdToHtml({ path: "$.content" });
74-
expect(plugin.hooks.onContentFetchDone(ctx)).rejects.toThrow(
74+
await expect(plugin.hooks.onContentFetchDone(ctx)).rejects.toThrow(
7575
"Error applying content transform",
7676
);
7777
});

packages/content/src/plugins/__tests__/media-downloader.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import path from "node:path";
1+
import path from "node:path/posix";
22
import { vol } from "memfs";
33
import { http, HttpResponse } from "msw";
44
import { setupServer } from "msw/node";

packages/content/src/sources/__tests__/airtable-source.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ describe("airtableSource", () => {
174174
const result = source.fetch(createFetchContext());
175175
expect(result).toHaveLength(1);
176176

177-
expect(result[0]!.data).rejects.toThrow();
177+
await expect(result[0]!.data).rejects.toThrow();
178178
});
179179

180180
it("should handle invalid key-value table data", async () => {
@@ -202,7 +202,7 @@ describe("airtableSource", () => {
202202
const result = source.fetch(createFetchContext());
203203
expect(result).toHaveLength(1);
204204

205-
expect(result[0]!.data).rejects.toThrow();
205+
await expect(result[0]!.data).rejects.toThrow();
206206
});
207207

208208
it("should handle unauthorized access", async () => {
@@ -222,6 +222,6 @@ describe("airtableSource", () => {
222222
const result = source.fetch(createFetchContext());
223223
expect(result).toHaveLength(1);
224224

225-
expect(result[0]!.data).rejects.toThrow();
225+
await expect(result[0]!.data).rejects.toThrow();
226226
});
227227
});

packages/content/src/sources/__tests__/contentful-source.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ function createFetchContext() {
2828

2929
describe("contentfulSource", () => {
3030
it("should fail with missing delivery token when not using preview", async () => {
31-
expect(
31+
await expect(
3232
async () =>
3333
// @ts-expect-error - testing invalid options
3434
await contentfulSource({
@@ -41,7 +41,7 @@ describe("contentfulSource", () => {
4141
});
4242

4343
it("should fail with missing preview token when using preview", async () => {
44-
expect(
44+
await expect(
4545
async () =>
4646
// @ts-expect-error - testing invalid options
4747
await contentfulSource({
@@ -227,7 +227,7 @@ describe("contentfulSource", () => {
227227

228228
const result = source.fetch(createFetchContext());
229229

230-
expect(result.data).rejects.toThrow();
230+
await expect(result.data).rejects.toThrow();
231231
});
232232

233233
it("should handle contentful errors array", async () => {
@@ -248,7 +248,7 @@ describe("contentfulSource", () => {
248248

249249
const result = source.fetch(createFetchContext());
250250

251-
expect(result.data).rejects.toThrow();
251+
await expect(result.data).rejects.toThrow();
252252
});
253253

254254
it("should respect content type filtering", async () => {

packages/content/src/sources/__tests__/json-source.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ describe("jsonSource", () => {
7373
const result = source.fetch(createFetchContext());
7474
expect(result).toHaveLength(1);
7575

76-
expect(async () => {
76+
await expect(async () => {
7777
await result[0]!.data;
7878
}).rejects.toThrow();
7979
});
@@ -98,7 +98,7 @@ describe("jsonSource", () => {
9898

9999
expect(result).toHaveLength(1);
100100

101-
expect(async () => {
101+
await expect(async () => {
102102
await result[0]!.data;
103103
}).rejects.toThrow();
104104
});
@@ -122,14 +122,14 @@ describe("jsonSource", () => {
122122

123123
const promise = result[0]!.data;
124124

125-
expect(promise).rejects.toThrow();
126-
127125
// Need to run the timer and wait for the rejection
128-
await vi.runAllTimersAsync();
126+
vi.runAllTimersAsync();
127+
128+
await expect(promise).rejects.toThrow();
129129
});
130130

131131
it("should throw on incomplete config", async () => {
132132
// @ts-expect-error - incomplete config
133-
expect(() => jsonSource({})).toThrow();
133+
await expect(() => jsonSource({})).toThrow();
134134
});
135135
});

packages/content/src/sources/__tests__/strapi-source.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ function createFetchContext() {
2828

2929
describe("strapiSource", () => {
3030
it("should fail with unsupported version", async () => {
31-
expect(() =>
31+
await expect(() =>
3232
strapiSource({
3333
id: "test-strapi",
3434
baseUrl: "http://localhost:1337",
@@ -278,7 +278,7 @@ describe("strapiSource", () => {
278278
}),
279279
);
280280

281-
expect(
281+
await expect(
282282
strapiSource({
283283
id: "test-strapi",
284284
version: "4",
@@ -312,6 +312,6 @@ describe("strapiSource", () => {
312312
const result = source.fetch(createFetchContext());
313313
expect(result).toHaveLength(1);
314314

315-
expect(async () => (await result[0]!.data.next()).value).rejects.toThrow();
315+
await expect(async () => (await result[0]!.data.next()).value).rejects.toThrow();
316316
});
317317
});

packages/content/src/utils/__tests__/content-transform-utils.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ describe("content-transform-utils", () => {
7575
throw new Error("Transform error");
7676
};
7777

78-
expect(
78+
await expect(
7979
applyTransformToFiles({
8080
dataStore,
8181
path: "$.content",

packages/content/src/utils/__tests__/data-store.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import path from "node:path";
1+
import path from "node:path/posix";
22
import { vol } from "memfs";
33
import { afterEach, beforeEach, describe, expect, it } from "vitest";
44
import { DataStore } from "../data-store.js";

packages/utils/src/__tests__/log-manager.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import path from "node:path";
1+
import path from "node:path/posix";
22
import moment from "moment";
33
import { afterAll, afterEach, beforeEach, describe, expect, it, vi } from "vitest";
44
import winston from "winston";

0 commit comments

Comments
 (0)