@gameroom/kit
Version:
Node kit for the Gameroom API
111 lines (106 loc) • 2.92 kB
JavaScript
const chai = require('chai')
const {
models: { Gift_Certificate }
} = require('../../')
const should = chai.should()
let object
describe('Gift_Certificate', () => {
describe('Gift_Certificate.create()', () => {
it('should create an gift_certificate', async () => {
let result, error
try {
result = await Gift_Certificate.create()
} catch (err) {
error = err
}
should.not.exist(error)
should.exist(result)
result.should.be.a('object')
object = result
})
})
describe('Gift_Certificate.get()', () => {
it('should get array of gift_certificates', async () => {
let result, error
try {
result = await Gift_Certificate.get()
} catch (err) {
error = err
}
should.not.exist(error)
should.exist(result)
result.should.be.a('array')
})
})
describe('Gift_Certificate.getAll()', () => {
it('should get array of all gift_certificates', async () => {
let result, error
try {
result = await Gift_Certificate.getAll()
} catch (err) {
error = err
}
should.not.exist(error)
should.exist(result)
result.should.be.a('array')
})
})
describe('Gift_Certificate.find()', () => {
it('should find a gift_certificate', async () => {
let result, error
try {
result = await Gift_Certificate.find(object, { view: 'full' })
} catch (err) {
error = err
}
should.not.exist(error)
should.exist(result)
result.should.be.a('object')
object = result
})
})
describe('Gift_Certificate keys', () => {
it('should match api and kit keys', async () => {
const raw = await Gift_Certificate.schema.adapter.find(Gift_Certificate.schema, object.id)
Object.keys(new Gift_Certificate()).sort().should.deep.equal(Object.keys(raw).sort())
})
})
describe('Gift_Certificate.update()', () => {
it('should update a gift_certificate', async () => {
let result, error
try {
result = await Gift_Certificate.update(object)
} catch (err) {
error = err
}
should.not.exist(error)
should.exist(result)
result.should.be.a('object')
})
})
describe('gift_certificate.save()', () => {
it('should update one gift_certificates', async () => {
let result, error
try {
result = await object.save()
} catch (err) {
error = err
}
should.not.exist(error)
should.exist(result)
result.should.be.a('object')
})
})
describe('Gift_Certificate.delete()', () => {
it('should delete one gift_certificate', async () => {
let result, error
try {
result = await Gift_Certificate.delete(object)
} catch (err) {
error = err
}
should.not.exist(error)
should.exist(result)
})
})
})