example.spec.js
1 import * as fc from '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 test('The concatenation of a, b and c always contains b', () => { 7 fc.assert( 8 fc.property(fc.string(), fc.string(), fc.string(), (a, b, c) => { 9 return contains(b, a + b + c); 10 }) 11 ); 12 }); 13 test('Also works with expect', () => { 14 fc.assert( 15 fc.property(fc.string(), fc.string(), fc.string(), (a, b, c) => { 16 expect(contains(b, a + b + c)).toBe(true); 17 }) 18 ); 19 });