diff --git a/deno.json b/deno.json index 084b0b0..7a551b1 100644 --- a/deno.json +++ b/deno.json @@ -7,7 +7,9 @@ } }, "imports": { - "@std/assert": "https://deno.land/std@0.224.0/assert/mod.ts" + "@std/assert": "https://deno.land/std@0.224.0/assert/mod.ts", + "@/": "./source/", + "#deps": "./deps.ts" }, "exports": { ".": "./source/mod.ts", @@ -17,8 +19,8 @@ }, "lock": false, "tasks": { - "test": "deno test --allow-net source/", - "test:coverage": "deno test --allow-net --coverage=coverage source/", + "test": "deno test --allow-net tests/", + "test:coverage": "deno test --allow-net --coverage=coverage tests/", "lint": "deno lint", "fmt": "deno fmt", "fmt:check": "deno fmt --check", @@ -41,5 +43,8 @@ "rules": { "exclude": ["no-slow-types"] } + }, + "test": { + "include": ["tests/"] } } diff --git a/source/Fetch_test.ts b/tests/Fetch.test.ts similarity index 99% rename from source/Fetch_test.ts rename to tests/Fetch.test.ts index 4ff0252..fafda92 100644 --- a/source/Fetch_test.ts +++ b/tests/Fetch.test.ts @@ -1,5 +1,5 @@ import { assertEquals } from "@std/assert"; -import { Fetchify } from "./Fetch.ts"; +import { Fetchify } from "@/Fetch.ts"; function mockFetch() { const originalFetch = globalThis.fetch; diff --git a/source/Limiter_test.ts b/tests/Limiter.test.ts similarity index 99% rename from source/Limiter_test.ts rename to tests/Limiter.test.ts index ad5d413..fdc92f6 100644 --- a/source/Limiter_test.ts +++ b/tests/Limiter.test.ts @@ -1,5 +1,5 @@ import { assertEquals } from "@std/assert"; -import { Limiter } from "./Limiter.ts"; +import { Limiter } from "@/Limiter.ts"; function mockFetch(response: Response = new Response("", { status: 200 })) { const originalFetch = globalThis.fetch; diff --git a/source/fetchWithTimeout_test.ts b/tests/fetchWithTimeout.test.ts similarity index 97% rename from source/fetchWithTimeout_test.ts rename to tests/fetchWithTimeout.test.ts index eae7975..8a7bbd0 100644 --- a/source/fetchWithTimeout_test.ts +++ b/tests/fetchWithTimeout.test.ts @@ -1,5 +1,5 @@ import { assertEquals, assertRejects } from "@std/assert"; -import { fetchWithTimeout } from "./fetchWithTimeout.ts"; +import { fetchWithTimeout } from "@/fetchWithTimeout.ts"; Deno.test("fetchWithTimeout - successful request within timeout", async () => { const originalFetch = globalThis.fetch; diff --git a/source/helpers_test.ts b/tests/helpers.test.ts similarity index 99% rename from source/helpers_test.ts rename to tests/helpers.test.ts index 6255d20..2b48ae5 100644 --- a/source/helpers_test.ts +++ b/tests/helpers.test.ts @@ -3,7 +3,7 @@ import { combineURL, getUrlFromStringOrRequest, objectToQueryParams, -} from "./helpers.ts"; +} from "@/helpers.ts"; Deno.test("objectToQueryParams - converts object to query string", () => { const params = { foo: "bar", baz: 123, active: true }; diff --git a/source/parsers_test.ts b/tests/parsers.test.ts similarity index 96% rename from source/parsers_test.ts rename to tests/parsers.test.ts index 353e635..1d28bf1 100644 --- a/source/parsers_test.ts +++ b/tests/parsers.test.ts @@ -1,6 +1,6 @@ import { assertEquals, assertRejects } from "@std/assert"; -import { v, z } from "../deps.ts"; -import { json, jsonV, jsonZ, text } from "./parsers.ts"; +import { v, z } from "#deps"; +import { json, jsonV, jsonZ, text } from "@/parsers.ts"; Deno.test("text - parses response as text", async () => { const mockResponse = new Response("Hello, World!", { status: 200 });