expect
expect copied to clipboard
helpers for writing jest like expect tests in deno
Note: is as close to the Jest version as I could make it, but I had difficulty implementing some of the test cases, particularly those that threw Matcher errors, or...
I like the [Chai's expect](https://www.chaijs.com/api/bdd/) and a feature that is useful is the custom error message, because this allows to tag some test, specify the error in the test, or...
I would like to be able to assert the type of an error that is thrown with `expect(...).toThrow()`. For example: ```ts expect(() => rgbColor(255, 255, 999)).toThrow(RangeError); ```
I found a way with importmap and `sinon` to mock out a dependency. https://stackoverflow.com/questions/69677679/deno-mock-out-named-import-in-unit-test/69682382#69682382 The great think about `sinon` is that I can modify the `mock` to behave how I...
I wrote that test ```javascript it('allows to register multiple callbacks', () => { const callback = mock.fn(); const callback2 = mock.fn(); const observable = createObservable(); observable.register(callback); observable.register(callback2); observable.notify(); expect(callback).toHaveBeenCalled(); expect(callback2).toHaveBeenCalled();...
I want to test a function to return an object with some properties matching regexes, some just pure values there's a handy matcher in Jest for that: https://jestjs.io/docs/expect#tomatchobjectobject would be...
Would be nice to have `expect.any` to test if objects have proper types for a large set of properties (e.g. `obj.x` is a number) ref: https://jestjs.io/docs/expect#expectanyconstructor jest/expect code: https://github.com/facebook/jest/blob/e0b33b74b5afd738edc183858b5c34053cfc26dd/packages/expect/src/asymmetricMatchers.ts#L22 possible...