Skip to content

Integrating Mocha unit test with fast-check results in unexpected behavior #4297

Answered by dubzzz
weilirs asked this question in Q&A
Discussion options

You must be logged in to vote

Same with async/await would be:

it.only('should return an error when the user does not exist fuzzing', async () => {
  await fc.assert(
    fc.asyncProperty(
      fc.nat().map((randomString) => `lkajdfijain${randomString}`),
      async (name) => {
        return new Promise((innerResolve, innerReject) => {
          request
            .get(api('users.info'))
            .set(credentials)
            .query({
              username: name,
            })
            .expect('Content-Type', 'application/json')
            .expect(400)
            .expect((res) => {
              console.log('res.body: ', res.body);
              expect(res.body).to.have.property('success', false);

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@dubzzz
Comment options

Answer selected by weilirs
@weilirs
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants