Skip to content

Commit

Permalink
remove usage of deprecated std member
Browse files Browse the repository at this point in the history
  • Loading branch information
erfanium committed Mar 24, 2024
1 parent 14c9a06 commit ea7e821
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
10 changes: 5 additions & 5 deletions test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// deno-lint-ignore-file require-await
import { MongoClient, ObjectId, UUID } from "./mod.ts";
import { assertEquals, deferred } from "./test_deps.ts";
import { assertEquals } from "./test_deps.ts";

Deno.test("Sample Test", async () => {
const fetchMock = deferred<{ url: string; init: RequestInit }>();
const fetchMock = Promise.withResolvers<{ url: string; init: RequestInit }>();

const client = new MongoClient({
endpoint: "https://data.mongodb-api.com/app/data-abc/endpoint/data/v1",
Expand All @@ -30,15 +30,15 @@ Deno.test("Sample Test", async () => {
uuid: new UUID("408ebbdc-2651-4aa4-8298-3aef14e78f7e"),
});

const { url, init } = await fetchMock;
const { url, init } = await fetchMock.promise;
assertEquals(
url,
"https://data.mongodb-api.com/app/data-abc/endpoint/data/v1/action/insertOne",
"https://data.mongodb-api.com/app/data-abc/endpoint/data/v1/action/insertOne"
);
assertEquals(init.method, "POST");
assertEquals(
new Headers(init.headers).get("Content-Type"),
"application/ejson",
"application/ejson"
);
assertEquals(new Headers(init.headers).get("api-key"), "API_KEY");
assertEquals(await new Request(url, init).json(), {
Expand Down
1 change: 0 additions & 1 deletion test_deps.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
export { deferred } from "https://deno.land/[email protected]/async/deferred.ts";
export { assertEquals } from "https://deno.land/[email protected]/testing/asserts.ts";

0 comments on commit ea7e821

Please sign in to comment.