github remix-run/remix assert@0.2.0
assert v0.2.0

5 hours ago

Minor Changes

  • Add expect API alongside the existing assert.* functions

    • expect(value).toBe(expected)
      • toBe, toEqual, toBeNull, toBeUndefined, toBeDefined, toBeTruthy, toBeInstanceOf
      • Numbers: toBeGreaterThan, toBeGreaterThanOrEqual, toBeLessThan, toBeLessThanOrEqual, toBeCloseTo
      • Strings / iterables: toContain, toMatch, toHaveLength
      • Object shape: toHaveProperty, (recursive partial equality)
      • Throwing: toThrow
      • Mock-aware (works with mock.fn() / mock.method() from @remix-run/test): toHaveBeenCalled, toHaveBeenCalledTimes, toHaveBeenCalledWith, toHaveBeenNthCalledWith
      • Partial matching: expect(value).toMatchObject(expected), expect(value).toEqual(expect.objectContaining(expected))

Patch Changes

  • Add missed object support to assert.throws and assert.rejects for validating individual error properties (e.g. { code: 'ERR_INVALID_ARG_VALUE' }). RegExp values inside the object match string properties; everything else uses deep equality.

Don't miss a new remix release

NewReleases is sending notifications on new releases.