deno.land / x / opine@2.3.4 / examples / error-pages / 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
import { superdeno } from "../../test/deps.ts";import { describe, it } from "../../test/utils.ts";import { app } from "./index.ts";
describe("error-pages", () => { describe("GET /", function () { it("should respond with page list", function (done) { superdeno(app) .get("/") .expect(/Pages Example/, done); }); });
describe("Accept: text/html", function () { describe("GET /403", function () { it("should respond with 403", function (done) { superdeno(app) .get("/403") .expect(403, done); }); });
describe("GET /404", function () { it("should respond with 404", function (done) { superdeno(app) .get("/404") .expect(404, done); }); });
describe("GET /500", function () { it("should respond with 500", function (done) { superdeno(app) .get("/500") .expect(500, done); }); }); });
describe("Accept: application/json", function () { describe("GET /403", function () { it("should respond with 403", function (done) { superdeno(app) .get("/403") .set("Accept", "application/json") .expect(403, done); }); });
describe("GET /404", function () { it("should respond with 404", function (done) { superdeno(app) .get("/404") .set("Accept", "application/json") .expect(404, { error: "Not Found" }, done); }); });
describe("GET /500", function () { it("should respond with 500", function (done) { superdeno(app) .get("/500") .set("Accept", "application/json") .expect(500, done); }); }); });
describe("Accept: text/plain", function () { describe("GET /403", function () { it("should respond with 403", function (done) { superdeno(app) .get("/403") .set("Accept", "text/plain") .expect(403, done); }); });
describe("GET /404", function () { it("should respond with 404", function (done) { superdeno(app) .get("/404") .set("Accept", "text/plain") .expect(404) .expect("Not Found", done); }); });
describe("GET /500", function () { it("should respond with 500", function (done) { superdeno(app) .get("/500") .set("Accept", "text/plain") .expect(500, done); }); }); });});
opine

Version Info

Tagged at
2 years ago