-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtest.js
61 lines (54 loc) · 2.46 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
require('with-env')();
var test = require("prova");
var photo = require("./")({
key: process.env.FLICKR_API_KEY
});
test('basic info', function (t) {
photo('14321741011', function (error, craterlake) {
t.plan(11);
t.error(error);
t.equal(craterlake.id, '14321741011');
t.equal(craterlake.title, 'Crater Lake');
t.deepEqual(craterlake.owner, {
id: "98269877@N00",
username: 'azer',
name: 'Azer Koçulu',
url: 'https://flickr.com/photos/azer',
icons: {
small: "https://farm3.staticflickr.com/2933/buddyicons/[email protected]",
medium: "https://farm3.staticflickr.com/2933/buddyicons/98269877@N00_r.jpg"
}
});
t.equal(craterlake.title, 'Crater Lake');
t.equal(craterlake.description, '');
t.equal(craterlake.postTS, 1401670228000);
t.equal(craterlake.takenTS, 1400987281000);
t.equal(craterlake.url, "https:\/\/www.flickr.com\/photos\/azer\/14321741011\/");
t.equal(craterlake.format, "jpg");
t.ok(craterlake.views > 50);
});
});
test('urls', function (t) {
photo('14321741011', function (error, craterlake) {
t.plan(11);
t.error(error);
t.deepEqual(craterlake.urls.square, "https:\/\/farm3.staticflickr.com\/2922\/14321741011_aeb3b41d62_s.jpg");
t.deepEqual(craterlake.urls.largeSquare, "https:\/\/farm3.staticflickr.com\/2922\/14321741011_aeb3b41d62_q.jpg");
t.deepEqual(craterlake.urls.thumbnail, "https:\/\/farm3.staticflickr.com\/2922\/14321741011_aeb3b41d62_t.jpg");
t.deepEqual(craterlake.urls.small, "https:\/\/farm3.staticflickr.com\/2922\/14321741011_aeb3b41d62_m.jpg");
t.deepEqual(craterlake.urls.small320, "https:\/\/farm3.staticflickr.com\/2922\/14321741011_aeb3b41d62_n.jpg");
t.deepEqual(craterlake.urls.medium, "https:\/\/farm3.staticflickr.com\/2922\/14321741011_aeb3b41d62.jpg");
t.deepEqual(craterlake.urls.medium640, "https:\/\/farm3.staticflickr.com\/2922\/14321741011_aeb3b41d62_z.jpg");
t.deepEqual(craterlake.urls.medium800, "https:\/\/farm3.staticflickr.com\/2922\/14321741011_aeb3b41d62_c.jpg");
t.deepEqual(craterlake.urls.large, "https:\/\/farm3.staticflickr.com\/2922\/14321741011_aeb3b41d62_b.jpg");
t.deepEqual(craterlake.urls.original, "https:\/\/farm3.staticflickr.com\/2922\/14321741011_0ddc14584b_o.jpg");
});
});
test('png format', function (t) {
photo('14605009770', function (error, twister) {
t.plan(3);
t.error(error);
t.equal(twister.id, '14605009770');
t.equal(twister.format, "png");
});
});