Created
December 26, 2018 14:14
-
-
Save goldbergyoni/f540207418b3768a9280fcdb54ff5e4b to your computer and use it in GitHub Desktop.
property based testing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require('mocha-testcheck').install(); | |
| const {expect} = require('chai'); | |
| const faker = require('faker'); | |
| describe('Product service', () => { | |
| describe('Adding new', () => { | |
| //this will run 100 times with different random properties | |
| check.it('Add new product with random yet valid properties, always successful', | |
| gen.int, gen.string, (id, name) => { | |
| expect(addNewProduct(id, name).status).to.equal('approved'); | |
| }); | |
| }) | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment