-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathtest.js
62 lines (51 loc) · 1.48 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
62
import test from 'ava'
import {
getUserByUsername,
getMediaByCode,
getStories,
getStoriesFeed,
getMediaByLocation,
getUserHighlights
} from './index'
const {SESSIONID, USERID} = process.env
test('getUserByUsername', async t => {
const {user} = await getUserByUsername(
{username: 'instagram', userid: USERID, sessionid: SESSIONID}
)
t.is(user.id, '25025320')
t.is(user.username, 'instagram')
})
test('getUserHighlights', async t => {
const {status, tray} = await getUserHighlights({id: '25025320', userid: USERID, sessionid: SESSIONID})
t.is(status, 'ok')
})
test('getMediaByCode', async t => {
const {items} = await getMediaByCode(
{code: 'BUu14BdBkO5', userid: USERID, sessionid: SESSIONID})
t.is(items[0].pk, 1526394270041654300)
})
test('getStories', async t => {
const {id, user, items, status} = await getStories(
{id: 25025320, userid: USERID, sessionid: SESSIONID}
)
t.is(status, 'ok')
t.true(Array.isArray(items))
if (items.length > 0) {
t.is(id, 25025320)
t.is(user.username, 'instagram')
}
})
test('getStoriesFeed', async t => {
const {tray, status} = await getStoriesFeed(
{userid: USERID, sessionid: SESSIONID}
)
t.is(status, 'ok')
t.true(Array.isArray(tray))
})
test('getMediaByLocation', async t => {
const {location_info: location} = await getMediaByLocation(
{id: '292188415', userid: USERID, sessionid: SESSIONID}
)
t.is(location.location_id, '292188415')
t.is(location.name, 'Eiffel Tower')
})