forked from MONEI/Shopify-api-node
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathevent.test.js
More file actions
67 lines (47 loc) · 1.8 KB
/
event.test.js
File metadata and controls
67 lines (47 loc) · 1.8 KB
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
describe('Shopify#event', () => {
'use strict';
const expect = require('chai').expect;
const fixtures = require('./fixtures/event');
const common = require('./common');
const shopify = common.shopify;
const scope = common.scope;
afterEach(() => expect(scope.isDone()).to.be.true);
it('gets a list of events (1/2)', () => {
const output = fixtures.res.list;
scope.get('/admin/events.json').reply(200, output);
return shopify.event
.list()
.then((data) => expect(data).to.deep.equal(output.events));
});
it('gets a list of events (2/2)', () => {
const output = fixtures.res.list;
scope.get('/admin/events.json?page=1').reply(200, output);
return shopify.event
.list({ page: 1 })
.then((data) => expect(data).to.deep.equal(output.events));
});
it('gets a count of all events (1/2)', () => {
scope.get('/admin/events/count.json').reply(200, { count: 3 });
return shopify.event.count().then((data) => expect(data).to.deep.equal(3));
});
it('gets a count of all events (2/2)', () => {
scope.get('/admin/events/count.json?foo=bar').reply(200, { count: 3 });
return shopify.event
.count({ foo: 'bar' })
.then((data) => expect(data).to.deep.equal(3));
});
it('gets a single event by its ID (1/2)', () => {
const output = fixtures.res.get;
scope.get('/admin/events/677313116.json').reply(200, output);
return shopify.event
.get(677313116)
.then((data) => expect(data).to.deep.equal(output.event));
});
it('gets a single event by its ID (2/2)', () => {
const output = fixtures.res.get;
scope.get('/admin/events/677313116.json?foo=bar').reply(200, output);
return shopify.event
.get(677313116, { foo: 'bar' })
.then((data) => expect(data).to.deep.equal(output.event));
});
});