forked from kaiwood/pnut-butter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpnut_test.js
47 lines (36 loc) · 1.09 KB
/
pnut_test.js
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
const chai = require("chai");
const chaiAsPromised = require("chai-as-promised");
const nock = require("nock");
chai.use(chaiAsPromised);
chai.should();
const tavrn = require("../lib/tavrn");
before(function() {
let base = "https://api.sapphire.moe:7070/";
nock(base).get("/somewhere").reply(200, {});
nock(base).post("/somewhere").reply(200, {});
nock(base).put("/somewhere").reply(200, {});
nock(base).patch("/somewhere").reply(200, {});
});
after(function() {
nock.cleanAll();
});
describe("The tavrn-butter library", () => {
it("should be able to send a custom GET request", () => {
return tavrn.custom("/somewhere").should.become({});
});
it("should be able to send a custom POST request", () => {
return tavrn.custom("/somewhere", "POST", {
text: "sometext"
});
});
it("should be able to send a custom PUT request", () => {
return tavrn.custom("/somewhere", "PUT", {
text: "sometext"
});
});
it("should be able to send a custom PATCH request", () => {
return tavrn.custom("/somewhere", "PATCH", {
text: "sometext"
});
});
});