https://github.com/incuca/loopback-chai
Loopback Chai Assertions
https://github.com/incuca/loopback-chai
chai chaijs loopback tdd testing testing-library testing-tool
Last synced: about 1 month ago
JSON representation
Loopback Chai Assertions
- Host: GitHub
- URL: https://github.com/incuca/loopback-chai
- Owner: InCuca
- License: mit
- Created: 2018-05-04T16:31:06.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-05-27T00:42:29.000Z (almost 7 years ago)
- Last Synced: 2025-03-19T20:38:06.224Z (about 2 months ago)
- Topics: chai, chaijs, loopback, tdd, testing, testing-library, testing-tool
- Language: JavaScript
- Size: 418 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# loopback-chai
[](https://travis-ci.org/InCuca/loopback-chai/branches) [](https://codeclimate.com/github/InCuca/loopback-chai/test_coverage)
[](https://codeclimate.com/github/InCuca/loopback-chai/maintainability)Repository of [chai](http://www.chaijs.com) assertions for loopback
## External Dependencies
This plugin expects that you have [chai](http://www.chaijs.com) and [loopback](http://loopback.io) packages available to import.
## Usage with Chai
```js
import chai from 'chai';
import loopbackChai from 'loopback-chai';chai.use(loopbackChai);
```## Added Assertions
```js
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)
```