https://github.com/johngeorgewright/chai-match
Advanced RegExp assertions for the Chai.js framework
https://github.com/johngeorgewright/chai-match
assertions chai chai-match regexp regexp-assertions regexp-captures
Last synced: 1 day ago
JSON representation
Advanced RegExp assertions for the Chai.js framework
- Host: GitHub
- URL: https://github.com/johngeorgewright/chai-match
- Owner: johngeorgewright
- License: mit
- Created: 2015-05-22T14:07:41.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2017-02-24T12:24:51.000Z (about 8 years ago)
- Last Synced: 2024-04-09T23:09:21.562Z (about 1 year ago)
- Topics: assertions, chai, chai-match, regexp, regexp-assertions, regexp-captures
- Language: JavaScript
- Size: 11.7 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Chai Match
==========[](https://travis-ci.org/johngeorgewright/chai-match)
[](https://www.npmjs.com/package/chai-match)
[](https://gemnasium.com/github.com/johngeorgewright/chai-match)
[](https://github.com/johngeorgewright/chai-match/blob/master/LICENSE)> Advanced RegExp assertions for Chai.js.
Installation
------------```
npm i --save-dev chai-match
``````javascript
var chai = require('chai');
chai.use(require('chai-match'));
```API
---### `.capture(n)`
Sets the assertion object to a previous match's capture.
```javascript
expect('some thing to test').to.match(/some (\w+) to test/).and.capture(0).equals('thing');
'Here in London'.should.match(/(here|there) in (\w+)/i).and.capture(1).equals('London');
```