Skip to content

Commit

Permalink
Use biome and check
Browse files Browse the repository at this point in the history
  • Loading branch information
blck-snwmn committed Apr 2, 2024
1 parent 5653233 commit 71bd169
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 9 deletions.
22 changes: 22 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"$schema": "https://biomejs.dev/schemas/1.3.3/schema.json",
"organizeImports": {
"enabled": true,
"ignore": ["graphql/src/gql/*", "node_modules/*"]
},
"formatter": {
"ignore": [
"node_modules/*",
"*/build/*",
"*/.wrangler/*",
"graphql/src/gql/*"
]
},
"linter": {
"ignore": ["node_modules/*", "*/build/*", "*/.wrangler/*", "*/gql/*"],
"enabled": true,
"rules": {
"recommended": true
}
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"start": "wrangler dev"
},
"devDependencies": {
"@biomejs/biome": "^1.6.2",
"@biomejs/biome": "^1.6.3",
"@cloudflare/vitest-pool-workers": "^0.1.5",
"@cloudflare/workers-types": "^4.20240320.1",
"typescript": "^5.3.3",
Expand Down
2 changes: 1 addition & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions test/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { randomBytes } from "node:crypto";
import {
createExecutionContext,
createMessageBatch,
env,
fetchMock,
getQueueResult,
waitOnExecutionContext,
fetchMock,
} from "cloudflare:test";
import { afterEach, beforeAll, describe, expect, it, vi } from "vitest";
import worker from "../src/worker";
import { randomBytes } from "node:crypto";

const IncomingRequest = Request<unknown, IncomingRequestCfProperties>;

Expand All @@ -21,15 +21,15 @@ beforeAll(() => {

afterEach(() => {
vi.restoreAllMocks();
fetchMock.assertNoPendingInterceptors()
fetchMock.assertNoPendingInterceptors();
});

describe("test queue producer", () => {
it("produces queue message with mocked send", async () => {
// Intercept calls to `QUEUE_PRODUCER.send()`
const sendSpy = vi
.spyOn(env.SQUEUE, "send")
.mockImplementation(async () => { });
.mockImplementation(async () => {});

const now = new Date();

Expand Down Expand Up @@ -124,7 +124,7 @@ describe("test queue producer", () => {
it("produces queue message with mocked consumer", async () => {
const consumerSpy = vi
.spyOn(worker, "queue")
.mockImplementation(async () => { });
.mockImplementation(async () => {});

const now = new Date();

Expand Down Expand Up @@ -233,7 +233,7 @@ describe("test queue comsumer", () => {
body: JSON.stringify({
channel: "TEST_CHANNEL",
body: "Test",
})
}),
})
.reply(200);

Expand Down Expand Up @@ -262,4 +262,4 @@ describe("test queue comsumer", () => {
expect(result.retryMessages).toStrictEqual([]);
expect(result.explicitAcks).toStrictEqual([messages[0].id]);
});
})
});

0 comments on commit 71bd169

Please sign in to comment.