forked from alexclaes/pexels-api-wrapper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.test.js
41 lines (36 loc) · 1.2 KB
/
index.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
const PexelsAPI = require('./index.js');
const API_KEY = 'YOUR_API_KEY_HERE'
const pexelsClient = new PexelsAPI(API_KEY);
test('search', () => {
pexelsClient.search('cats', 15,1)
.then((data) => {
expect(data.error).toBeUndefined();
expect(data.page).toBe(1);
expect(data.per_page).toBe(15);
expect(data.photos).toBeDefined();
expect(data.photos.length).toBe(15);
})
.catch((data) => {});
});
test('getPopularPhotos', () => {
pexelsClient.getPopularPhotos(15,1)
.then((data) => {
expect(data.error).toBeUndefined();
expect(data.page).toBe(1);
expect(data.per_page).toBe(15);
expect(data.photos).toBeDefined();
expect(data.photos.length).toBe(15);
})
.catch((data) => {});
});
test('getCuratedPhotos', () => {
pexelsClient.getCuratedPhotos(15,1)
.then((data) => {
expect(data.error).toBeUndefined();
expect(data.page).toBe(1);
expect(data.per_page).toBe(15);
expect(data.photos).toBeDefined();
expect(data.photos.length).toBe(15);
})
.catch((data) => {});
});