Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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 2 months 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 (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-05-27T00:42:29.000Z (over 6 years ago)
- Last Synced: 2024-11-21T11:39:19.932Z (2 months ago)
- Topics: chai, chaijs, loopback, tdd, testing, testing-library, testing-tool
- Language: JavaScript
- Size: 418 KB
- Stars: 1
- Watchers: 4
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# loopback-chai
[![Travis](https://img.shields.io/travis/InCuca/loopback-chai/master.svg)](https://travis-ci.org/InCuca/loopback-chai/branches) [![Code Climate](https://img.shields.io/codeclimate/coverage/InCuca/loopback-chai.svg)](https://codeclimate.com/github/InCuca/loopback-chai/test_coverage)
[![Code Climate](https://img.shields.io/codeclimate/maintainability/InCuca/loopback-chai.svg)](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)
```