loopback-chai

Chai assertions for loopback

Usage no npm install needed!

<script type="module">
  import loopbackChai from 'https://cdn.skypack.dev/loopback-chai';
</script>

README

loopback-chai

Travis Code Climate Code Climate

Repository of chai assertions for loopback

External Dependencies

This plugin expects that you have chai and loopback packages available to import.

Usage with Chai

import chai from 'chai';
import loopbackChai from 'loopback-chai';

chai.use(loopbackChai);

Added Assertions

expect(modelInstance).to.be.model
expect(Model).to.have.relationship('name', 'RelatedModel')
expect(Model).to.have.a.propertyOfType('property', Object)
expect(Model).to.belongsTo('relationship', 'RelatedModel')
expect(Model).to.belongsTo('relationship', 'RelatedModel', 'relatedModelId')
expect(Model).to.haveOne('relationship', 'RelatedModel')
expect(Model).to.haveOne('relationship', 'RelatedModel', 'relatedModelId')
expect(Model).to.haveMany('relationship', 'RelatedModel')
expect(Model).to.haveMany('relationship', 'RelatedModel', 'relatedModelId')
expect(Model).to.inherits(BaseModel)