Skip to content

Commit 74f9b2d

Browse files
committed
Move mutation tests into their own files to demonstrate an idea which could be applied across all snapshots. Also, only mutation events are relevant here (reduce burden when manually expecting test output). Also (commented out) showing how to reuse expected output between tests, i.e. assert that two tests produce same output
1 parent 53550a2 commit 74f9b2d

8 files changed

+320
-681
lines changed
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
[
2+
{
3+
"type": 3,
4+
"data": {
5+
"source": 0,
6+
"texts": [],
7+
"attributes": [],
8+
"removes": [],
9+
"adds": [
10+
{
11+
"parentId": 7,
12+
"nextId": null,
13+
"node": {
14+
"type": 2,
15+
"tagName": "div",
16+
"attributes": {
17+
"id": "d1"
18+
},
19+
"childNodes": [],
20+
"id": 9
21+
}
22+
},
23+
{
24+
"parentId": 9,
25+
"nextId": null,
26+
"node": {
27+
"type": 2,
28+
"tagName": "div",
29+
"attributes": {
30+
"id": "d3"
31+
},
32+
"childNodes": [],
33+
"id": 10
34+
}
35+
},
36+
{
37+
"parentId": 9,
38+
"nextId": 10,
39+
"node": {
40+
"type": 2,
41+
"tagName": "div",
42+
"attributes": {
43+
"id": "d2"
44+
},
45+
"childNodes": [],
46+
"id": 11
47+
}
48+
},
49+
{
50+
"parentId": 9,
51+
"nextId": 11,
52+
"node": {
53+
"type": 2,
54+
"tagName": "span",
55+
"attributes": {},
56+
"childNodes": [],
57+
"id": 12
58+
}
59+
},
60+
{
61+
"parentId": 11,
62+
"nextId": null,
63+
"node": {
64+
"type": 2,
65+
"tagName": "span",
66+
"attributes": {},
67+
"childNodes": [],
68+
"id": 13
69+
}
70+
},
71+
{
72+
"parentId": 10,
73+
"nextId": null,
74+
"node": {
75+
"type": 2,
76+
"tagName": "span",
77+
"attributes": {},
78+
"childNodes": [],
79+
"id": 14
80+
}
81+
}
82+
]
83+
}
84+
}
85+
]
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
[
2+
{
3+
"type": 3,
4+
"data": {
5+
"source": 0,
6+
"texts": [],
7+
"attributes": [],
8+
"removes": [],
9+
"adds": [
10+
{
11+
"parentId": 7,
12+
"nextId": null,
13+
"node": {
14+
"type": 2,
15+
"tagName": "div",
16+
"attributes": {
17+
"id": "d1"
18+
},
19+
"childNodes": [],
20+
"id": 9
21+
}
22+
},
23+
{
24+
"parentId": 9,
25+
"nextId": null,
26+
"node": {
27+
"type": 2,
28+
"tagName": "div",
29+
"attributes": {
30+
"id": "d3"
31+
},
32+
"childNodes": [],
33+
"id": 10
34+
}
35+
},
36+
{
37+
"parentId": 9,
38+
"nextId": 10,
39+
"node": {
40+
"type": 2,
41+
"tagName": "div",
42+
"attributes": {
43+
"id": "d2"
44+
},
45+
"childNodes": [],
46+
"id": 11
47+
}
48+
},
49+
{
50+
"parentId": 9,
51+
"nextId": 11,
52+
"node": {
53+
"type": 2,
54+
"tagName": "span",
55+
"attributes": {},
56+
"childNodes": [],
57+
"id": 12
58+
}
59+
},
60+
{
61+
"parentId": 11,
62+
"nextId": null,
63+
"node": {
64+
"type": 2,
65+
"tagName": "span",
66+
"attributes": {},
67+
"childNodes": [],
68+
"id": 13
69+
}
70+
},
71+
{
72+
"parentId": 10,
73+
"nextId": null,
74+
"node": {
75+
"type": 2,
76+
"tagName": "span",
77+
"attributes": {},
78+
"childNodes": [],
79+
"id": 14
80+
}
81+
}
82+
]
83+
}
84+
}
85+
]
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
[
2+
{
3+
"type": 3,
4+
"data": {
5+
"source": 0,
6+
"texts": [],
7+
"attributes": [],
8+
"removes": [],
9+
"adds": [
10+
{
11+
"parentId": 7,
12+
"nextId": null,
13+
"node": {
14+
"type": 2,
15+
"tagName": "div",
16+
"attributes": {},
17+
"childNodes": [],
18+
"id": 9
19+
}
20+
},
21+
{
22+
"parentId": 9,
23+
"nextId": null,
24+
"node": {
25+
"type": 2,
26+
"tagName": "div",
27+
"attributes": {},
28+
"childNodes": [],
29+
"id": 10
30+
}
31+
}
32+
]
33+
}
34+
}
35+
]
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
[
2+
{
3+
"type": 3,
4+
"data": {
5+
"source": 0,
6+
"texts": [],
7+
"attributes": [],
8+
"removes": [],
9+
"adds": [
10+
{
11+
"parentId": 7,
12+
"nextId": null,
13+
"node": {
14+
"type": 2,
15+
"tagName": "div",
16+
"attributes": {},
17+
"childNodes": [],
18+
"id": 9
19+
}
20+
},
21+
{
22+
"parentId": 9,
23+
"nextId": null,
24+
"node": {
25+
"type": 2,
26+
"tagName": "div",
27+
"attributes": {},
28+
"childNodes": [],
29+
"id": 10
30+
}
31+
}
32+
]
33+
}
34+
}
35+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
[
2+
{
3+
"type": 3,
4+
"data": {
5+
"source": 0,
6+
"texts": [],
7+
"attributes": [],
8+
"removes": [],
9+
"adds": [
10+
{
11+
"parentId": 7,
12+
"nextId": null,
13+
"node": {
14+
"type": 2,
15+
"tagName": "div",
16+
"attributes": {},
17+
"childNodes": [],
18+
"id": 9
19+
}
20+
},
21+
{
22+
"parentId": 9,
23+
"nextId": null,
24+
"node": {
25+
"type": 2,
26+
"tagName": "div",
27+
"attributes": {},
28+
"childNodes": [],
29+
"id": 10
30+
}
31+
},
32+
{
33+
"parentId": 9,
34+
"nextId": 10,
35+
"node": {
36+
"type": 2,
37+
"tagName": "div",
38+
"attributes": {},
39+
"childNodes": [],
40+
"id": 11
41+
}
42+
}
43+
]
44+
}
45+
}
46+
]

0 commit comments

Comments
 (0)