Skip to content

Commit dc4ab9a

Browse files
committed
Added Data Files for Safe Regex Unit Test Mocks
1 parent 2dc9cb4 commit dc4ab9a

File tree

6 files changed

+232
-0
lines changed

6 files changed

+232
-0
lines changed

test/data/invalidDocument.json

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
{
2+
"title": "Regex Fields",
3+
"uid": "regex_fields",
4+
"inbuilt_class": false,
5+
"schema": [
6+
{
7+
"data_type": "text",
8+
"display_name": "Regex 1",
9+
"uid": "regex_1",
10+
"format": "\\/(((([^\\/\\s\\*]+\\*?)+\\/)|(\\*{1,2})\\/)+)?(((([^\\/\\s\\*]+\\*?)+)|(\\*{1,2}))+)?",
11+
"error_messages": {
12+
"format": "\\/(((([^\\/\\s\\*]+\\*?)+\\/)|(\\*{1,2})\\/)+)?(((([^\\/\\s\\*]+\\*?)+)|(\\*{1,2}))+)?"
13+
}
14+
},
15+
{
16+
"data_type": "text",
17+
"display_name": "Regex 2",
18+
"uid": "regex_2",
19+
"format": "(beep|boop)*",
20+
"error_messages": {
21+
"format": "(beep|boop)*"
22+
}
23+
},
24+
{
25+
"data_type": "group",
26+
"display_name": "Regex Group",
27+
"schema": [
28+
{
29+
"data_type": "text",
30+
"display_name": "Group Regex 1",
31+
"uid": "group_regex_1",
32+
"format": "\\/(((([^\\/\\s\\*]+\\*?)+\\/)|(\\*{1,2})\\/)+)?(((([^\\/\\s\\*]+\\*?)+)|(\\*{1,2}))+)?",
33+
"error_messages": {
34+
"format": ""
35+
}
36+
}
37+
],
38+
"uid": "regex_group"
39+
},
40+
{
41+
"data_type": "group",
42+
"display_name": "Regex Group",
43+
"uid": "regex_group"
44+
},
45+
{
46+
"data_type": "blocks",
47+
"display_name": "Regex Modular Blocks",
48+
"blocks": [
49+
{
50+
"title": "MB 1",
51+
"uid": "mb_1",
52+
"schema": [
53+
{
54+
"data_type": "group",
55+
"display_name": "Group",
56+
"schema": [
57+
{
58+
"data_type": "text",
59+
"display_name": "MB Group Regex",
60+
"uid": "mb_group_regex",
61+
"format": "\\/(((([^\\/\\s\\*]+\\*?)+\\/)|(\\*{1,2})\\/)+)?(((([^\\/\\s\\*]+\\*?)+)|(\\*{1,2}))+)?",
62+
"error_messages": {
63+
"format": ""
64+
}
65+
}
66+
],
67+
"uid": "group"
68+
},
69+
{
70+
"data_type": "text",
71+
"display_name": "MB Regex",
72+
"uid": "mb_regex",
73+
"format": "\\/(((([^\\/\\s\\*]+\\*?)+\\/)|(\\*{1,2})\\/)+)?(((([^\\/\\s\\*]+\\*?)+)|(\\*{1,2}))+)?",
74+
"error_messages": {
75+
"format": ""
76+
}
77+
}
78+
]
79+
},
80+
{
81+
"title": "MB 2",
82+
"uid": "mb_2"
83+
}
84+
],
85+
"uid": "regex_modular_blocks"
86+
},
87+
{
88+
"data_type": "text",
89+
"display_name": "Regex 6",
90+
"uid": "regex_6",
91+
"format": "\\/(((([^\\/\\s\\*]+\\*?)+\\/)|(\\*{1,2})\\/)+)?(((([^\\/\\s\\*]+\\*?)+)|(\\*{1,2}))+)?",
92+
"error_messages": {
93+
"format": ""
94+
}
95+
}
96+
]
97+
}

test/data/invalidRegex.json

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
[
2+
{
3+
"Module": "Content Type",
4+
"Title": "Regex Fields",
5+
"UID": "regex_fields",
6+
"Field Title": "Regex 1",
7+
"Field UID": "regex_1",
8+
"Field Path": "regex_1",
9+
"Invalid Regex": "\\/(((([^\\/\\s\\*]+\\*?)+\\/)|(\\*{1,2})\\/)+)?(((([^\\/\\s\\*]+\\*?)+)|(\\*{1,2}))+)?"
10+
},
11+
{
12+
"Module": "Content Type",
13+
"Title": "Regex Fields",
14+
"UID": "regex_fields",
15+
"Field Title": "Group Regex 1",
16+
"Field UID": "group_regex_1",
17+
"Field Path": "regex_group.group_regex_1",
18+
"Invalid Regex": "\\/(((([^\\/\\s\\*]+\\*?)+\\/)|(\\*{1,2})\\/)+)?(((([^\\/\\s\\*]+\\*?)+)|(\\*{1,2}))+)?"
19+
},
20+
{
21+
"Module": "Content Type",
22+
"Title": "Regex Fields",
23+
"UID": "regex_fields",
24+
"Field Title": "MB Group Regex",
25+
"Field UID": "mb_group_regex",
26+
"Field Path": "regex_modular_blocks.mb_1.group.mb_group_regex",
27+
"Invalid Regex": "\\/(((([^\\/\\s\\*]+\\*?)+\\/)|(\\*{1,2})\\/)+)?(((([^\\/\\s\\*]+\\*?)+)|(\\*{1,2}))+)?"
28+
},
29+
{
30+
"Module": "Content Type",
31+
"Title": "Regex Fields",
32+
"UID": "regex_fields",
33+
"Field Title": "MB Regex",
34+
"Field UID": "mb_regex",
35+
"Field Path": "regex_modular_blocks.mb_1.mb_regex",
36+
"Invalid Regex": "\\/(((([^\\/\\s\\*]+\\*?)+\\/)|(\\*{1,2})\\/)+)?(((([^\\/\\s\\*]+\\*?)+)|(\\*{1,2}))+)?"
37+
},
38+
{
39+
"Module": "Content Type",
40+
"Title": "Regex Fields",
41+
"UID": "regex_fields",
42+
"Field Title": "Regex 6",
43+
"Field UID": "regex_6",
44+
"Field Path": "regex_6",
45+
"Invalid Regex": "\\/(((([^\\/\\s\\*]+\\*?)+\\/)|(\\*{1,2})\\/)+)?(((([^\\/\\s\\*]+\\*?)+)|(\\*{1,2}))+)?"
46+
}
47+
]

test/data/invalidRegexGf.json

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
[
2+
{
3+
"Module": "Global Field",
4+
"Title": "Regex Fields",
5+
"UID": "regex_fields",
6+
"Field Title": "Regex 1",
7+
"Field UID": "regex_1",
8+
"Field Path": "regex_1",
9+
"Invalid Regex": "\\/(((([^\\/\\s\\*]+\\*?)+\\/)|(\\*{1,2})\\/)+)?(((([^\\/\\s\\*]+\\*?)+)|(\\*{1,2}))+)?"
10+
},
11+
{
12+
"Module": "Global Field",
13+
"Title": "Regex Fields",
14+
"UID": "regex_fields",
15+
"Field Title": "Group Regex 1",
16+
"Field UID": "group_regex_1",
17+
"Field Path": "regex_group.group_regex_1",
18+
"Invalid Regex": "\\/(((([^\\/\\s\\*]+\\*?)+\\/)|(\\*{1,2})\\/)+)?(((([^\\/\\s\\*]+\\*?)+)|(\\*{1,2}))+)?"
19+
},
20+
{
21+
"Module": "Global Field",
22+
"Title": "Regex Fields",
23+
"UID": "regex_fields",
24+
"Field Title": "MB Group Regex",
25+
"Field UID": "mb_group_regex",
26+
"Field Path": "regex_modular_blocks.mb_1.group.mb_group_regex",
27+
"Invalid Regex": "\\/(((([^\\/\\s\\*]+\\*?)+\\/)|(\\*{1,2})\\/)+)?(((([^\\/\\s\\*]+\\*?)+)|(\\*{1,2}))+)?"
28+
},
29+
{
30+
"Module": "Global Field",
31+
"Title": "Regex Fields",
32+
"UID": "regex_fields",
33+
"Field Title": "MB Regex",
34+
"Field UID": "mb_regex",
35+
"Field Path": "regex_modular_blocks.mb_1.mb_regex",
36+
"Invalid Regex": "\\/(((([^\\/\\s\\*]+\\*?)+\\/)|(\\*{1,2})\\/)+)?(((([^\\/\\s\\*]+\\*?)+)|(\\*{1,2}))+)?"
37+
},
38+
{
39+
"Module": "Global Field",
40+
"Title": "Regex Fields",
41+
"UID": "regex_fields",
42+
"Field Title": "Regex 6",
43+
"Field UID": "regex_6",
44+
"Field Path": "regex_6",
45+
"Invalid Regex": "\\/(((([^\\/\\s\\*]+\\*?)+\\/)|(\\*{1,2})\\/)+)?(((([^\\/\\s\\*]+\\*?)+)|(\\*{1,2}))+)?"
46+
}
47+
]

test/data/tableData.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[
2+
{
3+
"Module": "Content Type",
4+
"Title": "Regex Fields",
5+
"UID": "regex_fields",
6+
"Invalid Regex Count": 5
7+
}
8+
]

test/data/tableDataGf.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[
2+
{
3+
"Module": "Global Field",
4+
"Title": "Regex Fields",
5+
"UID": "regex_fields",
6+
"Invalid Regex Count": 5
7+
}
8+
]

test/data/validDocument.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"title": "Regex Fields",
3+
"uid": "regex_fields",
4+
"inbuilt_class": false,
5+
"schema": [
6+
{
7+
"data_type": "text",
8+
"display_name": "Regex 1",
9+
"uid": "regex_1",
10+
"format": "(beep|boop)*",
11+
"error_messages": {
12+
"format": ""
13+
}
14+
},
15+
{
16+
"data_type": "text",
17+
"display_name": "Regex 2",
18+
"uid": "regex_2",
19+
"format": "",
20+
"error_messages": {
21+
"format": ""
22+
}
23+
}
24+
]
25+
}

0 commit comments

Comments
 (0)