UNPKG

@gameroom/kit

Version:

Node kit for the Gameroom API

114 lines (109 loc) 2.98 kB
const { faker } = require('@faker-js/faker'), chai = require('chai') const { models: { Container_Audit } } = require('../../') const should = chai.should() let object describe('Container_Audit', () => { describe('Container_Audit.create()', () => { it('should create an container_audit', async () => { let result, error try { result = await Container_Audit.create({ name: faker.random.word() }) } catch (err) { error = err } should.not.exist(error) should.exist(result) result.should.be.a('object') object = result }) }) describe('Container_Audit.get()', () => { it('should get array of container_audits', async () => { let result, error try { result = await Container_Audit.get() } catch (err) { error = err } should.not.exist(error) should.exist(result) result.should.be.a('array') }) }) describe('Container_Audit.getAll()', () => { it('should get array of all container_audits', async () => { let result, error try { result = await Container_Audit.getAll() } catch (err) { error = err } should.not.exist(error) should.exist(result) result.should.be.a('array') }) }) describe('Container_Audit.find()', () => { it('should find a container_audit', async () => { let result, error try { result = await Container_Audit.find(object, { view: 'full' }) } catch (err) { error = err } should.not.exist(error) should.exist(result) result.should.be.a('object') object = result }) }) describe('Container_Audit keys', () => { it('should match api and kit keys', async () => { const raw = await Container_Audit.schema.adapter.find(Container_Audit.schema, object.id) Object.keys(new Container_Audit()).sort().should.deep.equal(Object.keys(raw).sort()) }) }) describe('Container_Audit.update()', () => { it('should update a container_audit', async () => { let result, error try { result = await Container_Audit.update(object) } catch (err) { error = err } should.not.exist(error) should.exist(result) result.should.be.a('object') }) }) describe('container_audit.save()', () => { it('should update one container_audit', 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('Container_Audit.delete()', () => { it('should delete one container_audit', async () => { let result, error try { result = await Container_Audit.delete(object) } catch (err) { error = err } should.not.exist(error) should.exist(result) }) }) })