This repository has been archived on 2024-07-19. You can view files and clone it, but cannot push or open issues or pull requests.
works-on-my-machine/tests/expect.test.ts
Marc Cataford 329103c470
feat: getting something going (#1)
* feat: basics

* chore: lint

* wip: slightly better expect logic

* test: use self for test cases

* ci: enable test, build steps

* chore: lint

* docs: readme stub

* feat: toBe

* chore: lockfile
2023-04-14 09:38:15 -04:00

73 lines
1.2 KiB
TypeScript

import { test, expect } from '../src/testCaseUtils'
test('Equality (number)', () => {
expect(1).toEqual(1)
})
test('Equality (string)', () => {
expect('expectations').toEqual('expectations')
})
test('Equality (boolean)', () => {
expect(true).toEqual(true)
})
test('Equality (failed - number)', () => {
try {
expect(1).toEqual(2)
} catch (e) {
expect(1).toEqual(1)
}
})
test('Equality (failed - string)', () => {
try {
expect('expectation').toEqual('something else')
} catch (e) {
expect(1).toEqual(1)
}
})
test('Equality (failed - boolean)', () => {
try {
expect(true).toEqual(false)
} catch (e) {
expect(1).toEqual(1)
}
})
test('Identity comparison (number)', () => {
expect(1).toBe(1)
})
test('Identity comparison (boolean)', () => {
expect(true).toBe(true)
})
test('Identity comparison (string)', () => {
expect('identity').toBe('identity')
})
test('Identity comparison (failed - number)', () => {
try {
expect(1).toEqual(2)
} catch (e) {
expect(1).toEqual(1)
}
})
test('Identity comparison (failed - boolean)', () => {
try {
expect(false).toBe(true)
} catch (e) {
expect(1).toEqual(1)
}
})
test('Identity comparison (failed - string)', () => {
try {
expect('yes').toBe('no')
} catch (e) {
expect(1).toEqual(1)
}
})