-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.mjs
49 lines (39 loc) · 1.25 KB
/
test.mjs
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import {assert as ok} from 'assert'
import * as p from 'preact'
import * as c from 'preact/compat'
import {equal} from './react-change.mjs'
const now = new Date()
test(p.createElement)
test(c.createElement)
function test(E) {
ok(equal(
E(
'div',
{one: {two: ['three', new URL(`https://example.com`), new Date(now)]}, equal},
E(Comp, {}, [NaN]),
),
E(
'div',
{one: {two: ['three', new URL(`https://example.com`), new Date(now)]}, equal},
E(Comp, {}, [NaN]),
),
))
ok(!equal(
E('div', {one: {two: ['three']}, equal}, E(Comp, {}, [NaN])),
E('div', {one: {two: ['three']}, equal}, E(Comp, {}, [Infinity])),
))
ok(!equal(
E('div', {one: {two: ['three']}, equal}, E(Comp, {}, [NaN])),
E('div', {one: {two: ['four']}, equal}, E(Comp, {}, [NaN])),
))
ok(!equal(
E('div', {one: {two: [() => {}]}, equal}, E(Comp, {}, [NaN])),
E('div', {one: {two: [() => {}]}, equal}, E(Comp, {}, [NaN])),
))
ok(equal(new URL(`https://example.com`), new URL(`https://example.com`)))
ok(!equal(new URL(`https://example.com#one`), new URL(`https://example.com#two`)))
ok(equal(new Date(now), new Date(now)))
ok(!equal(new Date(now), new Date(now + 1)))
}
function Comp() {}
console.log(`[test] ok`)