forked from MONEI/Shopify-api-node
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcollection-listing.test.js
More file actions
67 lines (48 loc) · 2 KB
/
collection-listing.test.js
File metadata and controls
67 lines (48 loc) · 2 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#collectionListing', () => {
'use strict';
const expect = require('chai').expect;
const fixtures = require('./fixtures/collection-listing');
const common = require('./common');
const shopify = common.shopify;
const scope = common.scope;
afterEach(() => expect(scope.isDone()).to.be.true);
it('gets collection listings published to an application (1/2)', () => {
const output = fixtures.res.list;
scope.get('/admin/collection_listings.json').reply(200, output);
return shopify.collectionListing
.list()
.then((data) => expect(data).to.deep.equal(output.collection_listings));
});
it('gets collection listings published to an application (2/2)', () => {
const output = fixtures.res.list;
scope.get('/admin/collection_listings.json?page=1').reply(200, output);
return shopify.collectionListing
.list({ page: 1 })
.then((data) => expect(data).to.deep.equal(output.collection_listings));
});
it('gets product IDs published to a collection (1/2)', () => {
const output = fixtures.res.productIds;
scope
.get('/admin/collection_listings/841564295/product_ids.json')
.reply(200, output);
return shopify.collectionListing
.productIds(841564295)
.then((data) => expect(data).to.deep.equal(output.product_ids));
});
it('gets product IDs published to a collection (2/2)', () => {
const output = fixtures.res.productIds;
scope
.get('/admin/collection_listings/841564295/product_ids.json?limit=50')
.reply(200, output);
return shopify.collectionListing
.productIds(841564295, { limit: 50 })
.then((data) => expect(data).to.deep.equal(output.product_ids));
});
it('gets a collection listing by its ID', () => {
const output = fixtures.res.get;
scope.get('/admin/collection_listings/482865238.json').reply(200, output);
return shopify.collectionListing
.get(482865238)
.then((data) => expect(data).to.deep.equal(output.collection_listing));
});
});