Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-56497

Add assert.throwsCode shell helper for testing

    • Fully Compatible
    • Query Execution 2021-05-31, Query Execution 2021-06-14, Query Execution 2021-06-28

      We have a helperĀ assert.throws() which returns the error which was thrown. A common pattern looks like this:

      let err = assert.throws(() => coll.aggregate(...));
      assert.eq(err.code, expectedCode);
      

      We should add a helper to the assertion library to condense this and simplify some of our tests. It will be a good counterpart to assert.commandFailedWithCode.

            Assignee:
            sebastien.mendez@mongodb.com Sebastien Mendez
            Reporter:
            charlie.swanson@mongodb.com Charlie Swanson
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: