Testing

Assertions

Built-in expect() assertions.

1 min readDocumentationEdit this page

Assertions#

typescript
expect(value).toBe(42)
expect(value).toEqual({ name: 'Tariq' })
expect(value).toBeTruthy()
expect(value).toBeNull()
expect(value).not.toBe(0)
expect(arr).toHaveLength(3)
expect(arr).toContain('item')
expect(obj).toHaveProperty('name')
expect(str).toMatch(/pattern/)
expect(() => fn()).toThrow()
await expect(promise).rejects.toThrow()

Help improve the documentation

AxilJS is open source and documentation improvements are welcome.

AxilJS DocumentationMIT License · Built by SyntaxilitY