deno.land / x / opine@2.3.4 / examples / static-files / index.test.ts

نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
import { superdeno } from "../../test/deps.ts";import { describe, it } from "../../test/utils.ts";import { app } from "./index.ts";
const toOsNewlines = (str: string) => Deno.build.os === "windows" ? str.replaceAll("\n", "\r\n") : str;
describe("static-files", () => { describe("`public` on /", () => { it("should serve hello.txt", async () => { await superdeno(app) .get("/hello.txt") .expect(200, "Hello Deno!"); });
it("should serve js/app.js", async () => { await superdeno(app) .get("/js/app.js") .expect(200, toOsNewlines("// app.js\n")); });
it("should serve js/helper.js", async () => { await superdeno(app) .get("/js/helper.js") .expect(200, toOsNewlines("// helper.js\n")); });
it("should serve css/style.css", async () => { await superdeno(app) .get("/css/style.css") .expect( 200, toOsNewlines( "/* style.css */\nbody {\n background: darkslategrey;\n}\n", ), ); }); });
describe("`public` on /static", () => { it("should serve hello.txt", async () => { await superdeno(app) .get("/static/hello.txt") .expect(200, "Hello Deno!"); });
it("should serve js/app.js", async () => { await superdeno(app) .get("/static/js/app.js") .expect(200, toOsNewlines("// app.js\n")); });
it("should serve js/helper.js", async () => { await superdeno(app) .get("/static/js/helper.js") .expect(200, toOsNewlines("// helper.js\n")); });
it("should serve css/style.css", async () => { await superdeno(app) .get("/static/css/style.css") .expect( 200, toOsNewlines( "/* style.css */\nbody {\n background: darkslategrey;\n}\n", ), ); }); });
describe("`public/css` on /", () => { it("should serve css/style.css", async () => { await superdeno(app) .get("/style.css") .expect( 200, toOsNewlines( "/* style.css */\nbody {\n background: darkslategrey;\n}\n", ), ); }); });});
opine

Version Info

Tagged at
2 years ago