/ test-jasmine / example.spec.js
example.spec.js
 1  const fc = require('fast-check');
 2  
 3  ///*bug*/ const contains = (pattern, text) => text.substr(1).indexOf(pattern) !== -1;
 4  const contains = (pattern, text) => text.indexOf(pattern) !== -1;
 5  
 6  describe('Jasmine Example', () => {
 7    it('The concatenation of a, b and c always contains b', () => {
 8      fc.assert(
 9        fc.property(fc.string(), fc.string(), fc.string(), (a, b, c) => {
10          return contains(b, a + b + c);
11        })
12      );
13    });
14    it('Also works with expect', () => {
15      // requires jasmine.json to set:
16      // "stopSpecOnExpectationFailure": true
17      fc.assert(
18        fc.property(fc.string(), fc.string(), fc.string(), (a, b, c) => {
19          expect(contains(b, a + b + c)).toBe(true);
20        })
21      );
22    });
23  });