@gameroom/kit
Version:
Node kit for the Gameroom API
54 lines (49 loc) • 1.26 kB
JavaScript
const chai = require('chai')
const {
models: { Product }
} = require('../../')
const should = chai.should()
let object
describe('Product', () => {
describe('Product.get()', () => {
it('should get a product', async () => {
let result, error
try {
result = await Product.get({ limit: 1 })
} catch (err) {
error = err
}
should.not.exist(error)
should.exist(result)
result.should.be.a('array')
result.length.should.equal(1)
object = result[0]
})
})
describe('product.syncWithShopify()', () => {
it('should sync a product with Shopify', async () => {
let result, error
try {
result = await object.syncWithShopify()
} catch (err) {
error = err
}
should.not.exist(result)
should.exist(error)
error?.response.status.should.equal(401)
})
})
describe('Product.syncWithShopify(id)', () => {
it('should sync a product with Shopify', async () => {
let result, error
try {
result = await Product.syncWithShopify(object.id)
} catch (err) {
error = err
}
should.not.exist(result)
should.exist(error)
error?.response.status.should.equal(401)
})
})
})