Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ganeshspatil/chai-asserttype
a simple chai plugin for js type assertions
https://github.com/ganeshspatil/chai-asserttype
assertions chai chai-asserttype chai-plugin
Last synced: 1 day ago
JSON representation
a simple chai plugin for js type assertions
- Host: GitHub
- URL: https://github.com/ganeshspatil/chai-asserttype
- Owner: GaneshSPatil
- License: other
- Created: 2016-11-17T16:30:59.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2016-11-18T06:03:59.000Z (about 8 years ago)
- Last Synced: 2025-02-14T09:39:09.906Z (1 day ago)
- Topics: assertions, chai, chai-asserttype, chai-plugin
- Language: JavaScript
- Size: 10.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# chai-asserttype
a simple chai plugin for js type assertions---
## Installation
```
npm install chai-asserttype
```---
## Usage
### plug-in
```
const chai = require('chai');
const asserttype = require('chai-asserttype');
chai.use(asserttype);
```### Number
Asserts that type of `actual` is Number.```
expect(1).to.be.number();
expect(0).to.be.number();
expect(-1).to.be.number();
expect(63465789908753).to.be.number();
expect(27.11).to.be.number();
```### String
Asserts that type of `actual` is String.```
expect('').to.be.string();
expect('foobar').to.be.string();
```### Boolean
Asserts that type of `actual` is Boolean.```
expect(true).to.be.boolean();
expect(false).to.be.boolean();
```### Object
Asserts that type of `actual` is Object.```
expect({}).to.be.object();
```### Array
Asserts that type of `actual` is Array.```
expect([]).to.be.array();
expect([1, 2, 3]).to.be.array();
```### Date
Asserts that type of `actual` is date.```
expect(new Date()).to.be.date();
```### Function
Asserts that type of `actual` is Function.```
expect(() => true).to.be.function();
```