UNPKG

@gameroom/gameroom-kit

Version:

Node kit for the Gameroom API

94 lines (92 loc) 2.55 kB
let chai = require('chai'), should = chai.should(), faker = require('faker'), { models } = require('../../'), { Gift_Certificate } = models, 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.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 () => { Object.keys(object).should.deep.equal(Object.keys(Gift_Certificate.schema.attributes)); }); }); 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); }); }); });