diff --git a/deno/add.test.ts b/deno/add.test.ts new file mode 100644 index 0000000..89f8cb5 --- /dev/null +++ b/deno/add.test.ts @@ -0,0 +1,9 @@ +import { assertStrictEquals } from "testing/asserts.ts"; +import { add } from "./add.ts"; + +Deno.test({ + name: "add", + fn() { + assertStrictEquals(add(1, 2), 3); + }, +}); diff --git a/deno/add.ts b/deno/add.ts new file mode 100644 index 0000000..bc81dd5 --- /dev/null +++ b/deno/add.ts @@ -0,0 +1 @@ +export const add = (a: number, b: number) => a + b; diff --git a/deno/app.ts b/deno/app.ts index c67e6be..444c9ae 100644 --- a/deno/app.ts +++ b/deno/app.ts @@ -1,4 +1,4 @@ -import { Handler, ServeInit, serve } from "http/server.ts"; +import { Handler, serve, ServeInit } from "http/server.ts"; const handler: Handler = () => new Response("Hello World\n"); const options: ServeInit = { addr: "localhost:8080" }; diff --git a/deno/deno.json b/deno/deno.json new file mode 100644 index 0000000..6516167 --- /dev/null +++ b/deno/deno.json @@ -0,0 +1,8 @@ +{ + "$schema": "https://raw.githubusercontent.com/denoland/deno/main/cli/schemas/config-file.v1.json", + "lint": { + "rules": { + "include": ["default-param-last", "eqeqeq"] + } + } +} diff --git a/deno/importmap.json b/deno/importmap.json index 42d1a9a..237ce2e 100644 --- a/deno/importmap.json +++ b/deno/importmap.json @@ -1,5 +1,6 @@ { "imports": { - "http/": "https://deno.land/std@0.115.1/http/" + "http/": "https://deno.land/std@0.115.1/http/", + "testing/": "https://deno.land/std@0.116.0/testing/" } } diff --git a/deno/scripts.yml b/deno/scripts.yml index 31fdd80..528301b 100644 --- a/deno/scripts.yml +++ b/deno/scripts.yml @@ -1,6 +1,12 @@ # yaml-language-server: $schema=https://deno.land/x/denon@2.4.10/schema.json -importmap: importmap.json + scripts: start: - cmd: "deno run app.ts" + cmd: "deno run --import-map=importmap.json app.ts" allow: [net] + test: + cmd: "deno test --import-map=importmap.json" + lint: + cmd: "deno lint --config=deno.json ." + fmt: + cmd: "deno fmt --config=deno.json ."