-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.test.ts
More file actions
27 lines (24 loc) · 898 Bytes
/
index.test.ts
File metadata and controls
27 lines (24 loc) · 898 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import { describe, expect, test } from 'bun:test'
import { createElement } from 'react'
describe('expect with ReactElement', () => {
test('should render ReactElement and format container', () => {
const element = createElement('div', null, 'Hello World')
// @ts-expect-error - mock transforms ReactElement to string at runtime
expect(element).toContain('Hello World')
})
})
describe('expect with HTMLElement', () => {
test('should format HTMLElement', () => {
const div = document.createElement('div')
div.textContent = 'Hello DOM'
// @ts-expect-error - mock transforms HTMLElement to string at runtime
expect(div).toContain('Hello DOM')
})
})
describe('expect with primitive value', () => {
test('should pass through primitive values', () => {
expect('hello').toBe('hello')
expect(123).toBe(123)
expect(123).toEqual(expect.any(Number))
})
})