-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathqiita-cli-url.test.ts
77 lines (63 loc) · 1.96 KB
/
qiita-cli-url.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
import {
apiItemsShowPath,
apiItemsUpdatePath,
apiReadmeShowPath,
itemsIndexPath,
itemsShowPath,
} from "./qiita-cli-url";
describe("apiItemsShowPath", () => {
const itemId = "c686397e4a0f4f11683d";
it("returns api items show path", () => {
const url = apiItemsShowPath(itemId);
expect(url).toEqual(`/api/items/${itemId}`);
});
describe("when itemId is 'show' and basename param exists", () => {
const itemId = "show";
const basename = "newArticle";
it("returns api items show path", () => {
const url = apiItemsShowPath(itemId, { basename: basename });
expect(url).toEqual(`/api/items/${itemId}?basename=${basename}`);
});
});
});
describe("apiItemsUpdatePath", () => {
const itemId = "c686397e4a0f4f11683d";
it("returns api items update path", () => {
const url = apiItemsUpdatePath(itemId);
expect(url).toEqual(`/api/items/${itemId}`);
});
describe("when itemId is 'show'", () => {
const itemId = "show";
it("returns api items update path", () => {
const url = apiItemsUpdatePath(itemId);
expect(url).toEqual(`/api/items/post`);
});
});
});
describe("apiReadmeShowPath", () => {
it("returns api readme show path", () => {
const url = apiReadmeShowPath();
expect(url).toEqual(`/api/readme`);
});
});
describe("itemsIndexPath", () => {
it("returns items index path", () => {
const url = itemsIndexPath();
expect(url).toEqual(`/`);
});
});
describe("itemsShowPath", () => {
const itemId = "c686397e4a0f4f11683d";
it("returns items show path", () => {
const url = itemsShowPath(itemId);
expect(url).toEqual(`/items/${itemId}`);
});
describe("when itemId is 'show' and basename param exists", () => {
const itemId = "show";
const basename = "newArticle";
it("returns items show path", () => {
const url = itemsShowPath(itemId, { basename: basename });
expect(url).toEqual(`/items/${itemId}?basename=${basename}`);
});
});
});