-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
41 lines (28 loc) · 1.21 KB
/
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
var test = require('tape');
var urls = require('./index.js');
test('titles', function(t) {
t.plan(1);
t.equal(urls.titles(), 'https://comichron-data.github.io/api/titles.json');
});
test('byMonth', function(t) {
t.plan(1);
t.equal(urls.byMonth('blah'), 'https://comichron-data.github.io/api/titles/blah/by-month.json');
});
test('byIssue', function(t) {
t.plan(1);
t.equal(urls.byIssue('blah'), 'https://comichron-data.github.io/api/titles/blah/by-issue.json');
});
test('sourceData with single digit month', function(t) {
t.plan(2);
t.equal(urls.sourceData(2001, 9), 'https://comichron-data.github.io/api/source-data/2001-09.json');
t.equal(urls.sourceData('2001', '9'), 'https://comichron-data.github.io/api/source-data/2001-09.json');
});
test('sourceData with double digit month', function(t) {
t.plan(2);
t.equal(urls.sourceData(2001, 11), 'https://comichron-data.github.io/api/source-data/2001-11.json');
t.equal(urls.sourceData('2001', '11'), 'https://comichron-data.github.io/api/source-data/2001-11.json');
});
test('sourceData only pads month if needed', function(t) {
t.plan(1);
t.equal(urls.sourceData('2001', '09'), 'https://comichron-data.github.io/api/source-data/2001-09.json');
});