2023-03-29 01:24:44 +00:00
|
|
|
import assert from 'assert'
|
2023-03-31 04:32:45 +00:00
|
|
|
import { describe, test, expect } from '../src/testCaseUtils'
|
2023-03-27 05:01:50 +00:00
|
|
|
|
2023-03-31 04:32:45 +00:00
|
|
|
describe('Equality', () => {
|
|
|
|
test('Equality (number)', () => {
|
|
|
|
assert.doesNotThrow(() => expect(1).toEqual(1))
|
|
|
|
})
|
2023-03-27 05:01:50 +00:00
|
|
|
|
2023-03-31 04:32:45 +00:00
|
|
|
test('Equality (string)', () => {
|
|
|
|
assert.doesNotThrow(() => expect('expectations').toEqual('expectations'))
|
|
|
|
})
|
2023-03-27 05:01:50 +00:00
|
|
|
|
2023-03-31 04:32:45 +00:00
|
|
|
test('Equality (boolean)', () => {
|
|
|
|
assert.doesNotThrow(() => expect(true).toEqual(true))
|
|
|
|
})
|
2023-03-27 05:01:50 +00:00
|
|
|
|
2023-03-31 04:32:45 +00:00
|
|
|
test('Equality (failed - number)', () => {
|
|
|
|
assert.throws(() => expect(1).toEqual(2))
|
|
|
|
})
|
2023-03-27 05:01:50 +00:00
|
|
|
|
2023-03-31 04:32:45 +00:00
|
|
|
test('Equality (failed - string)', () => {
|
|
|
|
assert.throws(() => expect('expectation').toEqual('something else'))
|
|
|
|
})
|
2023-03-27 05:01:50 +00:00
|
|
|
|
2023-03-31 04:32:45 +00:00
|
|
|
test('Equality (failed - boolean)', () => {
|
|
|
|
assert.throws(() => expect(true).toEqual(false))
|
|
|
|
})
|
2023-03-27 05:01:50 +00:00
|
|
|
})
|
|
|
|
|
2023-03-31 04:32:45 +00:00
|
|
|
describe('Identity', () => {
|
|
|
|
test('Identity comparison (number)', () => {
|
|
|
|
assert.doesNotThrow(() => expect(1).toBe(1))
|
|
|
|
})
|
2023-03-27 05:01:50 +00:00
|
|
|
|
2023-03-31 04:32:45 +00:00
|
|
|
test('Identity comparison (boolean)', () => {
|
|
|
|
assert.doesNotThrow(() => expect(true).toBe(true))
|
|
|
|
})
|
2023-03-27 05:01:50 +00:00
|
|
|
|
2023-03-31 04:32:45 +00:00
|
|
|
test('Identity comparison (string)', () => {
|
|
|
|
assert.doesNotThrow(() => expect('identity').toBe('identity'))
|
|
|
|
})
|
2023-03-27 05:01:50 +00:00
|
|
|
|
2023-03-31 04:32:45 +00:00
|
|
|
test('Identity comparison (failed - number)', () => {
|
|
|
|
assert.throws(() => expect(1).toEqual(2))
|
|
|
|
})
|
2023-03-27 05:01:50 +00:00
|
|
|
|
2023-03-31 04:32:45 +00:00
|
|
|
test('Identity comparison (failed - boolean)', () => {
|
|
|
|
assert.throws(() => expect(false).toBe(true))
|
|
|
|
})
|
2023-03-27 05:01:50 +00:00
|
|
|
|
2023-03-31 04:32:45 +00:00
|
|
|
test('Identity comparison (failed - string)', () => {
|
|
|
|
assert.throws(() => expect('yes').toBe('no'))
|
|
|
|
})
|
2023-03-29 01:24:44 +00:00
|
|
|
|
2023-03-31 04:32:45 +00:00
|
|
|
test('Equality negation', () => {
|
|
|
|
assert.doesNotThrow(() => expect('yes').not.toEqual('no'))
|
|
|
|
})
|
2023-03-29 01:24:44 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
test('Stacked equality negation', () => {
|
|
|
|
assert.doesNotThrow(() => expect('yes').not.not.toEqual('yes'))
|
|
|
|
})
|
|
|
|
|
|
|
|
test('Identity negation', () => {
|
|
|
|
assert.doesNotThrow(() => expect('yes').not.toBe('no'))
|
|
|
|
})
|
|
|
|
|
|
|
|
test('Identity negation (fail)', () => {
|
|
|
|
assert.throws(() => expect('yes').not.toBe('yes'))
|
2023-03-27 05:01:50 +00:00
|
|
|
})
|