forked from MONEI/Shopify-api-node
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshop.test.js
More file actions
47 lines (34 loc) · 1.25 KB
/
shop.test.js
File metadata and controls
47 lines (34 loc) · 1.25 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
describe('Shopify#shop', () => {
'use strict';
const expect = require('chai').expect;
const fixtures = require('./fixtures/shop');
const common = require('./common');
const Shopify = require('..');
const accessToken = common.accessToken;
const apiVersion = common.apiVersion;
const scope = common.scope;
const shopify = common.shopify;
const shopName = common.shopName;
afterEach(() => expect(scope.isDone()).to.be.true);
it('gets the configuration of the shop (1/2)', () => {
const output = fixtures.res.get;
scope.get('/admin/shop.json').reply(200, output);
return shopify.shop
.get()
.then((data) => expect(data).to.deep.equal(output.shop));
});
it('gets the configuration of the shop (2/2)', () => {
const output = fixtures.res.get;
scope.get('/admin/shop.json?foo=bar').reply(200, output);
return shopify.shop
.get({ foo: 'bar' })
.then((data) => expect(data).to.deep.equal(output.shop));
});
it('injects the api version to the request path if provided', () => {
const shopify = new Shopify({ shopName, accessToken, apiVersion });
scope
.get(`/admin/api/${apiVersion}/shop.json`)
.reply(200, { status: 'success' });
return shopify.shop.get();
});
});