Created
January 18, 2019 22:56
-
-
Save carlosrberto/b1296e672c6faa3f121880696e907158 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
➜ code-to-graph git:(master) yarn test | |
yarn run v1.7.0 | |
$ jest | |
FAIL ./index.test.js | |
● 1 | |
expect(received).toEqual(expected) | |
Expected value to equal: | |
"graph TD | |
subgraph f | |
statementfroml1c14tol1c23>\"return 5;\"] | |
style statementfroml1c14tol1c23 fill:#99FF99 | |
end | |
" | |
Received: | |
"graph TD | |
subgraph function f | |
froml1c14tol1c23>\"return 5;\"] | |
style froml1c14tol1c23 fill:#99FF99 | |
end | |
" | |
Difference: | |
- Expected | |
+ Received | |
graph TD | |
- subgraph f | |
- statementfroml1c14tol1c23>"return 5;"] | |
- style statementfroml1c14tol1c23 fill:#99FF99 | |
+ subgraph function f | |
+ froml1c14tol1c23>"return 5;"] | |
+ style froml1c14tol1c23 fill:#99FF99 | |
end | |
7 | const res = transformJsStringToMermaidString("function f(x){return 5;}"); | |
8 | // console.log(res); | |
> 9 | expect(res).toEqual( | |
| ^ | |
10 | `graph TD | |
11 | | |
12 | subgraph f | |
at Object.toEqual (index.test.js:9:15) | |
● 2 | |
expect(received).toEqual(expected) | |
Expected value to equal: | |
"graph TD | |
subgraph statementfroml1c0tol1c16 | |
statementfroml1c6tol1c15>\"return 5;\"] | |
style statementfroml1c6tol1c15 fill:#99FF99 | |
end | |
" | |
Received: | |
"graph TD | |
subgraph function froml1c0tol1c16 | |
froml1c6tol1c15>\"return 5;\"] | |
style froml1c6tol1c15 fill:#99FF99 | |
end | |
" | |
Difference: | |
- Expected | |
+ Received | |
graph TD | |
- subgraph statementfroml1c0tol1c16 | |
- statementfroml1c6tol1c15>"return 5;"] | |
- style statementfroml1c6tol1c15 fill:#99FF99 | |
+ subgraph function froml1c0tol1c16 | |
+ froml1c6tol1c15>"return 5;"] | |
+ style froml1c6tol1c15 fill:#99FF99 | |
end | |
22 | const res = transformJsStringToMermaidString("(x)=>{return 5;}"); | |
23 | // console.log(res); | |
> 24 | expect(res).toEqual(`graph TD | |
| ^ | |
25 | | |
26 | subgraph statementfroml1c0tol1c16 | |
27 | statementfroml1c6tol1c15>"return 5;"] | |
at Object.toEqual (index.test.js:24:15) | |
● 3 | |
expect(received).toEqual(expected) | |
Expected value to equal: | |
"graph TD | |
subgraph statementfroml1c0tol1c41 | |
statementfroml1c6tol1c40{\"if x === 0\"} | |
statementfroml1c16tol1c25>\"return 5;\"] | |
style statementfroml1c16tol1c25 fill:#99FF99 | |
statementfroml1c31tol1c39>\"return 4;\"] | |
style statementfroml1c31tol1c39 fill:#99FF99 | |
statementfroml1c6tol1c40 -- true --> statementfroml1c16tol1c25 | |
statementfroml1c6tol1c40 -- false --> statementfroml1c31tol1c39 | |
end | |
" | |
Received: | |
"graph TD | |
subgraph function froml1c0tol1c41 | |
froml1c6tol1c40{\"if x === 0\"} | |
froml1c16tol1c25>\"return 5;\"] | |
style froml1c16tol1c25 fill:#99FF99 | |
froml1c31tol1c39>\"return 4;\"] | |
style froml1c31tol1c39 fill:#99FF99 | |
froml1c6tol1c40 -- true --> froml1c16tol1c25 | |
froml1c6tol1c40 -- false --> froml1c31tol1c39 | |
end | |
" | |
Difference: | |
- Expected | |
+ Received | |
graph TD | |
- subgraph statementfroml1c0tol1c41 | |
- statementfroml1c6tol1c40{"if x === 0"} | |
- statementfroml1c16tol1c25>"return 5;"] | |
- style statementfroml1c16tol1c25 fill:#99FF99 | |
- statementfroml1c31tol1c39>"return 4;"] | |
- style statementfroml1c31tol1c39 fill:#99FF99 | |
- statementfroml1c6tol1c40 -- true --> statementfroml1c16tol1c25 | |
- statementfroml1c6tol1c40 -- false --> statementfroml1c31tol1c39 | |
+ subgraph function froml1c0tol1c41 | |
+ froml1c6tol1c40{"if x === 0"} | |
+ froml1c16tol1c25>"return 5;"] | |
+ style froml1c16tol1c25 fill:#99FF99 | |
+ froml1c31tol1c39>"return 4;"] | |
+ style froml1c31tol1c39 fill:#99FF99 | |
+ froml1c6tol1c40 -- true --> froml1c16tol1c25 | |
+ froml1c6tol1c40 -- false --> froml1c31tol1c39 | |
end | |
37 | ); | |
38 | // console.log(res); | |
> 39 | expect(res).toEqual(`graph TD | |
| ^ | |
40 | | |
41 | subgraph statementfroml1c0tol1c41 | |
42 | statementfroml1c6tol1c40{"if x === 0"} | |
at Object.toEqual (index.test.js:39:15) | |
● 4 | |
expect(received).toEqual(expected) | |
Expected value to equal: | |
"graph TD | |
subgraph statementfroml1c0tol1c64 | |
statementfroml1c6tol1c19(\"const a = f(x);\") | |
statementfroml1c19tol1c63{\"if x === 0\"} | |
statementfroml1c29tol1c38>\"return 5;\"] | |
style statementfroml1c29tol1c38 fill:#99FF99 | |
statementfroml1c44tol1c54(\"const c = 8;\") | |
statementfroml1c54tol1c62>\"return 4;\"] | |
style statementfroml1c54tol1c62 fill:#99FF99 | |
statementfroml1c19tol1c63 -- true --> statementfroml1c29tol1c38 | |
statementfroml1c19tol1c63 -- false --> statementfroml1c44tol1c54 | |
statementfroml1c44tol1c54 --> statementfroml1c54tol1c62 | |
statementfroml1c6tol1c19 --> statementfroml1c19tol1c63 | |
end | |
" | |
Received: | |
"graph TD | |
subgraph function froml1c0tol1c64 | |
froml1c6tol1c19(\"const a = f(x);\") | |
froml1c19tol1c63{\"if x === 0\"} | |
froml1c29tol1c38>\"return 5;\"] | |
style froml1c29tol1c38 fill:#99FF99 | |
froml1c44tol1c54(\"const c = 8;\") | |
froml1c54tol1c62>\"return 4;\"] | |
style froml1c54tol1c62 fill:#99FF99 | |
froml1c19tol1c63 -- true --> froml1c29tol1c38 | |
froml1c19tol1c63 -- false --> froml1c44tol1c54 | |
froml1c44tol1c54 --> froml1c54tol1c62 | |
froml1c6tol1c19 --> froml1c19tol1c63 | |
end | |
" | |
Difference: | |
- Expected | |
+ Received | |
graph TD | |
- subgraph statementfroml1c0tol1c64 | |
- statementfroml1c6tol1c19("const a = f(x);") | |
- statementfroml1c19tol1c63{"if x === 0"} | |
- statementfroml1c29tol1c38>"return 5;"] | |
- style statementfroml1c29tol1c38 fill:#99FF99 | |
- statementfroml1c44tol1c54("const c = 8;") | |
- statementfroml1c54tol1c62>"return 4;"] | |
- style statementfroml1c54tol1c62 fill:#99FF99 | |
- statementfroml1c19tol1c63 -- true --> statementfroml1c29tol1c38 | |
- statementfroml1c19tol1c63 -- false --> statementfroml1c44tol1c54 | |
- statementfroml1c44tol1c54 --> statementfroml1c54tol1c62 | |
- statementfroml1c6tol1c19 --> statementfroml1c19tol1c63 | |
+ subgraph function froml1c0tol1c64 | |
+ froml1c6tol1c19("const a = f(x);") | |
+ froml1c19tol1c63{"if x === 0"} | |
+ froml1c29tol1c38>"return 5;"] | |
+ style froml1c29tol1c38 fill:#99FF99 | |
+ froml1c44tol1c54("const c = 8;") | |
+ froml1c54tol1c62>"return 4;"] | |
+ style froml1c54tol1c62 fill:#99FF99 | |
+ froml1c19tol1c63 -- true --> froml1c29tol1c38 | |
+ froml1c19tol1c63 -- false --> froml1c44tol1c54 | |
+ froml1c44tol1c54 --> froml1c54tol1c62 | |
+ froml1c6tol1c19 --> froml1c19tol1c63 | |
end | |
57 | // console.log(res); | |
58 | | |
> 59 | expect(res).toEqual(`graph TD | |
| ^ | |
60 | | |
61 | subgraph statementfroml1c0tol1c64 | |
62 | statementfroml1c6tol1c19("const a = f(x);") | |
at Object.toEqual (index.test.js:59:15) | |
● 5 | |
expect(received).toEqual(expected) | |
Expected value to equal: | |
"graph TD | |
subgraph g | |
statementfroml1c16tol1c29(\"const a = f(x);\") | |
statementfroml1c29tol1c73{\"if x === 0\"} | |
statementfroml1c39tol1c48>\"return 5;\"] | |
style statementfroml1c39tol1c48 fill:#99FF99 | |
statementfroml1c54tol1c64(\"const c = 8;\") | |
statementfroml1c64tol1c72>\"return 4;\"] | |
style statementfroml1c64tol1c72 fill:#99FF99 | |
statementfroml1c29tol1c73 -- true --> statementfroml1c39tol1c48 | |
statementfroml1c29tol1c73 -- false --> statementfroml1c54tol1c64 | |
statementfroml1c54tol1c64 --> statementfroml1c64tol1c72 | |
statementfroml1c16tol1c29 --> statementfroml1c29tol1c73 | |
end | |
" | |
Received: | |
"graph TD | |
subgraph function g | |
froml1c16tol1c29(\"const a = f(x);\") | |
froml1c29tol1c73{\"if x === 0\"} | |
froml1c39tol1c48>\"return 5;\"] | |
style froml1c39tol1c48 fill:#99FF99 | |
froml1c54tol1c64(\"const c = 8;\") | |
froml1c64tol1c72>\"return 4;\"] | |
style froml1c64tol1c72 fill:#99FF99 | |
froml1c29tol1c73 -- true --> froml1c39tol1c48 | |
froml1c29tol1c73 -- false --> froml1c54tol1c64 | |
froml1c54tol1c64 --> froml1c64tol1c72 | |
froml1c16tol1c29 --> froml1c29tol1c73 | |
end | |
" | |
Difference: | |
- Expected | |
+ Received | |
graph TD | |
- subgraph g | |
- statementfroml1c16tol1c29("const a = f(x);") | |
- statementfroml1c29tol1c73{"if x === 0"} | |
- statementfroml1c39tol1c48>"return 5;"] | |
- style statementfroml1c39tol1c48 fill:#99FF99 | |
- statementfroml1c54tol1c64("const c = 8;") | |
- statementfroml1c64tol1c72>"return 4;"] | |
- style statementfroml1c64tol1c72 fill:#99FF99 | |
- statementfroml1c29tol1c73 -- true --> statementfroml1c39tol1c48 | |
- statementfroml1c29tol1c73 -- false --> statementfroml1c54tol1c64 | |
- statementfroml1c54tol1c64 --> statementfroml1c64tol1c72 | |
- statementfroml1c16tol1c29 --> statementfroml1c29tol1c73 | |
+ subgraph function g | |
+ froml1c16tol1c29("const a = f(x);") | |
+ froml1c29tol1c73{"if x === 0"} | |
+ froml1c39tol1c48>"return 5;"] | |
+ style froml1c39tol1c48 fill:#99FF99 | |
+ froml1c54tol1c64("const c = 8;") | |
+ froml1c64tol1c72>"return 4;"] | |
+ style froml1c64tol1c72 fill:#99FF99 | |
+ froml1c29tol1c73 -- true --> froml1c39tol1c48 | |
+ froml1c29tol1c73 -- false --> froml1c54tol1c64 | |
+ froml1c54tol1c64 --> froml1c64tol1c72 | |
+ froml1c16tol1c29 --> froml1c29tol1c73 | |
end | |
81 | // console.log(res); | |
82 | | |
> 83 | expect(res).toEqual(`graph TD | |
| ^ | |
84 | | |
85 | subgraph g | |
86 | statementfroml1c16tol1c29("const a = f(x);") | |
at Object.toEqual (index.test.js:83:15) | |
● 6 | |
expect(received).toEqual(expected) | |
Expected value to equal: | |
"graph TD | |
subgraph g | |
statementfroml1c24tol1c37(\"const a = w(x);\") | |
statementfroml1c37tol1c81{\"if x === 0\"} | |
statementfroml1c47tol1c56>\"return 6;\"] | |
style statementfroml1c47tol1c56 fill:#99FF99 | |
statementfroml1c62tol1c72(\"const c = 8;\") | |
statementfroml1c72tol1c80>\"return 4;\"] | |
style statementfroml1c72tol1c80 fill:#99FF99 | |
statementfroml1c37tol1c81 -- true --> statementfroml1c47tol1c56 | |
statementfroml1c37tol1c81 -- false --> statementfroml1c62tol1c72 | |
statementfroml1c62tol1c72 --> statementfroml1c72tol1c80 | |
statementfroml1c24tol1c37 --> statementfroml1c37tol1c81 | |
end | |
" | |
Received: | |
"graph TD | |
subgraph function g | |
froml1c24tol1c37(\"const a = w(x);\") | |
froml1c37tol1c81{\"if x === 0\"} | |
froml1c47tol1c56>\"return 6;\"] | |
style froml1c47tol1c56 fill:#99FF99 | |
froml1c62tol1c72(\"const c = 8;\") | |
froml1c72tol1c80>\"return 4;\"] | |
style froml1c72tol1c80 fill:#99FF99 | |
froml1c37tol1c81 -- true --> froml1c47tol1c56 | |
froml1c37tol1c81 -- false --> froml1c62tol1c72 | |
froml1c62tol1c72 --> froml1c72tol1c80 | |
froml1c24tol1c37 --> froml1c37tol1c81 | |
end | |
" | |
Difference: | |
- Expected | |
+ Received | |
graph TD | |
- subgraph g | |
- statementfroml1c24tol1c37("const a = w(x);") | |
- statementfroml1c37tol1c81{"if x === 0"} | |
- statementfroml1c47tol1c56>"return 6;"] | |
- style statementfroml1c47tol1c56 fill:#99FF99 | |
- statementfroml1c62tol1c72("const c = 8;") | |
- statementfroml1c72tol1c80>"return 4;"] | |
- style statementfroml1c72tol1c80 fill:#99FF99 | |
- statementfroml1c37tol1c81 -- true --> statementfroml1c47tol1c56 | |
- statementfroml1c37tol1c81 -- false --> statementfroml1c62tol1c72 | |
- statementfroml1c62tol1c72 --> statementfroml1c72tol1c80 | |
- statementfroml1c24tol1c37 --> statementfroml1c37tol1c81 | |
+ subgraph function g | |
+ froml1c24tol1c37("const a = w(x);") | |
+ froml1c37tol1c81{"if x === 0"} | |
+ froml1c47tol1c56>"return 6;"] | |
+ style froml1c47tol1c56 fill:#99FF99 | |
+ froml1c62tol1c72("const c = 8;") | |
+ froml1c72tol1c80>"return 4;"] | |
+ style froml1c72tol1c80 fill:#99FF99 | |
+ froml1c37tol1c81 -- true --> froml1c47tol1c56 | |
+ froml1c37tol1c81 -- false --> froml1c62tol1c72 | |
+ froml1c62tol1c72 --> froml1c72tol1c80 | |
+ froml1c24tol1c37 --> froml1c37tol1c81 | |
end | |
105 | // console.log(res); | |
106 | | |
> 107 | expect(res).toEqual(`graph TD | |
| ^ | |
108 | | |
109 | subgraph g | |
110 | statementfroml1c24tol1c37("const a = w(x);") | |
at Object.toEqual (index.test.js:107:15) | |
● 7 | |
expect(received).toEqual(expected) | |
Expected value to equal: | |
"graph TD | |
subgraph statementfroml1c0tol1c91 | |
statementfroml1c6tol1c19(\"const a = f(x);\") | |
statementfroml1c19tol1c90{\"if x === 0\"} | |
statementfroml1c29tol1c40(\"let a = null;\") | |
statementfroml1c41tol1c65>\"throw new Error('Nooes');\"] | |
style statementfroml1c41tol1c65 fill:#FF9999 | |
statementfroml1c71tol1c81(\"const c = 8;\") | |
statementfroml1c81tol1c89>\"return 4;\"] | |
style statementfroml1c81tol1c89 fill:#99FF99 | |
statementfroml1c19tol1c90 -- true --> statementfroml1c29tol1c40 | |
statementfroml1c19tol1c90 -- false --> statementfroml1c71tol1c81 | |
statementfroml1c29tol1c40 --> statementfroml1c41tol1c65 | |
statementfroml1c71tol1c81 --> statementfroml1c81tol1c89 | |
statementfroml1c6tol1c19 --> statementfroml1c19tol1c90 | |
end | |
" | |
Received: | |
"graph TD | |
subgraph function froml1c0tol1c91 | |
froml1c6tol1c19(\"const a = f(x);\") | |
froml1c19tol1c90{\"if x === 0\"} | |
froml1c29tol1c40(\"let a = null;\") | |
froml1c41tol1c65>\"throw new Error('Nooes');\"] | |
style froml1c41tol1c65 fill:#FF9999 | |
froml1c71tol1c81(\"const c = 8;\") | |
froml1c81tol1c89>\"return 4;\"] | |
style froml1c81tol1c89 fill:#99FF99 | |
froml1c19tol1c90 -- true --> froml1c29tol1c40 | |
froml1c19tol1c90 -- false --> froml1c71tol1c81 | |
froml1c29tol1c40 --> froml1c41tol1c65 | |
froml1c71tol1c81 --> froml1c81tol1c89 | |
froml1c6tol1c19 --> froml1c19tol1c90 | |
end | |
" | |
Difference: | |
- Expected | |
+ Received | |
graph TD | |
- subgraph statementfroml1c0tol1c91 | |
- statementfroml1c6tol1c19("const a = f(x);") | |
- statementfroml1c19tol1c90{"if x === 0"} | |
- statementfroml1c29tol1c40("let a = null;") | |
- statementfroml1c41tol1c65>"throw new Error('Nooes');"] | |
- style statementfroml1c41tol1c65 fill:#FF9999 | |
- statementfroml1c71tol1c81("const c = 8;") | |
- statementfroml1c81tol1c89>"return 4;"] | |
- style statementfroml1c81tol1c89 fill:#99FF99 | |
- statementfroml1c19tol1c90 -- true --> statementfroml1c29tol1c40 | |
- statementfroml1c19tol1c90 -- false --> statementfroml1c71tol1c81 | |
- statementfroml1c29tol1c40 --> statementfroml1c41tol1c65 | |
- statementfroml1c71tol1c81 --> statementfroml1c81tol1c89 | |
- statementfroml1c6tol1c19 --> statementfroml1c19tol1c90 | |
+ subgraph function froml1c0tol1c91 | |
+ froml1c6tol1c19("const a = f(x);") | |
+ froml1c19tol1c90{"if x === 0"} | |
+ froml1c29tol1c40("let a = null;") | |
+ froml1c41tol1c65>"throw new Error('Nooes');"] | |
+ style froml1c41tol1c65 fill:#FF9999 | |
+ froml1c71tol1c81("const c = 8;") | |
+ froml1c81tol1c89>"return 4;"] | |
+ style froml1c81tol1c89 fill:#99FF99 | |
+ froml1c19tol1c90 -- true --> froml1c29tol1c40 | |
+ froml1c19tol1c90 -- false --> froml1c71tol1c81 | |
+ froml1c29tol1c40 --> froml1c41tol1c65 | |
+ froml1c71tol1c81 --> froml1c81tol1c89 | |
+ froml1c6tol1c19 --> froml1c19tol1c90 | |
end | |
129 | // console.log(res); | |
130 | | |
> 131 | expect(res).toEqual(`graph TD | |
| ^ | |
132 | | |
133 | subgraph statementfroml1c0tol1c91 | |
134 | statementfroml1c6tol1c19("const a = f(x);") | |
at Object.toEqual (index.test.js:131:15) | |
● 8 | |
expect(received).toEqual(expected) | |
Expected value to equal: | |
"graph TD | |
subgraph q | |
statementfroml1c16tol1c90{\"switch x \"} | |
statementfroml1c34tol1c43>\"return 1;\"] | |
style statementfroml1c34tol1c43 fill:#99FF99 | |
statementfroml1c51tol1c61(\"const a = 1;\") | |
statementfroml1c61tol1c70>\"return 3;\"] | |
style statementfroml1c61tol1c70 fill:#99FF99 | |
statementfroml1c71tol1c72[\"Empty statement at line 1 column 71\"] | |
statementfroml1c81tol1c89>\"return 4;\"] | |
style statementfroml1c81tol1c89 fill:#99FF99 | |
statementfroml1c16tol1c90 -- 0 --> statementfroml1c34tol1c43 | |
statementfroml1c51tol1c61 --> statementfroml1c61tol1c70 | |
statementfroml1c16tol1c90 -- 2 --> statementfroml1c51tol1c61 | |
statementfroml1c16tol1c90 -- default --> statementfroml1c81tol1c89 | |
statementfroml1c71tol1c72 --> statementfroml1c81tol1c89 | |
end | |
" | |
Received: | |
"graph TD | |
subgraph function q | |
froml1c16tol1c90{\"switch x \"} | |
froml1c34tol1c43>\"return 1;\"] | |
style froml1c34tol1c43 fill:#99FF99 | |
froml1c51tol1c61(\"const a = 1;\") | |
froml1c61tol1c70>\"return 3;\"] | |
style froml1c61tol1c70 fill:#99FF99 | |
froml1c71tol1c72[\"Empty statement at line 1 column 71\"] | |
froml1c81tol1c89>\"return 4;\"] | |
style froml1c81tol1c89 fill:#99FF99 | |
froml1c16tol1c90 -- 0 --> froml1c34tol1c43 | |
froml1c51tol1c61 --> froml1c61tol1c70 | |
froml1c16tol1c90 -- 2 --> froml1c51tol1c61 | |
froml1c16tol1c90 -- default --> froml1c81tol1c89 | |
froml1c71tol1c72 --> froml1c81tol1c89 | |
end | |
" | |
Difference: | |
- Expected | |
+ Received | |
graph TD | |
- subgraph q | |
- statementfroml1c16tol1c90{"switch x "} | |
- statementfroml1c34tol1c43>"return 1;"] | |
- style statementfroml1c34tol1c43 fill:#99FF99 | |
- statementfroml1c51tol1c61("const a = 1;") | |
- statementfroml1c61tol1c70>"return 3;"] | |
- style statementfroml1c61tol1c70 fill:#99FF99 | |
- statementfroml1c71tol1c72["Empty statement at line 1 column 71"] | |
- statementfroml1c81tol1c89>"return 4;"] | |
- style statementfroml1c81tol1c89 fill:#99FF99 | |
- statementfroml1c16tol1c90 -- 0 --> statementfroml1c34tol1c43 | |
- statementfroml1c51tol1c61 --> statementfroml1c61tol1c70 | |
- statementfroml1c16tol1c90 -- 2 --> statementfroml1c51tol1c61 | |
- statementfroml1c16tol1c90 -- default --> statementfroml1c81tol1c89 | |
- statementfroml1c71tol1c72 --> statementfroml1c81tol1c89 | |
+ subgraph function q | |
+ froml1c16tol1c90{"switch x "} | |
+ froml1c34tol1c43>"return 1;"] | |
+ style froml1c34tol1c43 fill:#99FF99 | |
+ froml1c51tol1c61("const a = 1;") | |
+ froml1c61tol1c70>"return 3;"] | |
+ style froml1c61tol1c70 fill:#99FF99 | |
+ froml1c71tol1c72["Empty statement at line 1 column 71"] | |
+ froml1c81tol1c89>"return 4;"] | |
+ style froml1c81tol1c89 fill:#99FF99 | |
+ froml1c16tol1c90 -- 0 --> froml1c34tol1c43 | |
+ froml1c51tol1c61 --> froml1c61tol1c70 | |
+ froml1c16tol1c90 -- 2 --> froml1c51tol1c61 | |
+ froml1c16tol1c90 -- default --> froml1c81tol1c89 | |
+ froml1c71tol1c72 --> froml1c81tol1c89 | |
end | |
155 | // console.log(res); | |
156 | | |
> 157 | expect(res).toEqual(`graph TD | |
| ^ | |
158 | | |
159 | subgraph q | |
160 | statementfroml1c16tol1c90{"switch x "} | |
at Object.toEqual (index.test.js:157:15) | |
● 9 | |
expect(received).toEqual(expected) | |
Expected value to equal: | |
"graph TD | |
subgraph gogo | |
statementfroml2c10tol2c20(\"let y = 9;\") | |
statementfroml3c10tol10c11{\"switch x \"} | |
statementfroml4c22tol4c46>\"throw new Error('coco');\"] | |
style statementfroml4c22tol4c46 fill:#FF9999 | |
statementfroml5c22tol5c31>\"return 1;\"] | |
style statementfroml5c22tol5c31 fill:#99FF99 | |
statementfroml6c22tol6c33(\"const a = 98;\") | |
statementfroml6c33tol6c42>\"return 3;\"] | |
style statementfroml6c33tol6c42 fill:#99FF99 | |
statementfroml6c43tol6c44[\"Empty statement at line 6 column 43\"] | |
statementfroml7c22tol7c27(\"y = 5;\") | |
statementfroml8c22tol8c26(\"y = 9;\") | |
statementfroml8c27tol8c33[\"break;\"] | |
statementfroml9c23tol9c31>\"return 4;\"] | |
style statementfroml9c23tol9c31 fill:#99FF99 | |
statementfroml11c10tol11c25(\"console.log(y);\") | |
statementfroml12c10tol12c23>\"return y + 1;\"] | |
style statementfroml12c10tol12c23 fill:#99FF99 | |
statementfroml3c10tol10c11 -- 0 --> statementfroml4c22tol4c46 | |
statementfroml3c10tol10c11 -- 1 --> statementfroml5c22tol5c31 | |
statementfroml6c22tol6c33 --> statementfroml6c33tol6c42 | |
statementfroml3c10tol10c11 -- 2 --> statementfroml6c22tol6c33 | |
statementfroml3c10tol10c11 -- 3 --> statementfroml7c22tol7c27 | |
statementfroml6c43tol6c44 --> statementfroml7c22tol7c27 | |
statementfroml8c22tol8c26 --> statementfroml8c27tol8c33 | |
statementfroml3c10tol10c11 -- 4 --> statementfroml8c22tol8c26 | |
statementfroml7c22tol7c27 --> statementfroml8c22tol8c26 | |
statementfroml3c10tol10c11 -- default --> statementfroml9c23tol9c31 | |
statementfroml2c10tol2c20 --> statementfroml3c10tol10c11 | |
statementfroml8c27tol8c33 --> statementfroml11c10tol11c25 | |
statementfroml11c10tol11c25 --> statementfroml12c10tol12c23 | |
end | |
" | |
Received: | |
"graph TD | |
subgraph function gogo | |
froml2c10tol2c20(\"let y = 9;\") | |
froml3c10tol10c11{\"switch x \"} | |
froml4c22tol4c46>\"throw new Error('coco');\"] | |
style froml4c22tol4c46 fill:#FF9999 | |
froml5c22tol5c31>\"return 1;\"] | |
style froml5c22tol5c31 fill:#99FF99 | |
froml6c22tol6c33(\"const a = 98;\") | |
froml6c33tol6c42>\"return 3;\"] | |
style froml6c33tol6c42 fill:#99FF99 | |
froml6c43tol6c44[\"Empty statement at line 6 column 43\"] | |
froml7c22tol7c27(\"y = 5;\") | |
froml8c22tol8c26(\"y = 9;\") | |
froml8c27tol8c33[\"break;\"] | |
froml9c23tol9c31>\"return 4;\"] | |
style froml9c23tol9c31 fill:#99FF99 | |
froml11c10tol11c25(\"console.log(y);\") | |
froml12c10tol12c23>\"return y + 1;\"] | |
style froml12c10tol12c23 fill:#99FF99 | |
froml3c10tol10c11 -- 0 --> froml4c22tol4c46 | |
froml3c10tol10c11 -- 1 --> froml5c22tol5c31 | |
froml6c22tol6c33 --> froml6c33tol6c42 | |
froml3c10tol10c11 -- 2 --> froml6c22tol6c33 | |
froml3c10tol10c11 -- 3 --> froml7c22tol7c27 | |
froml6c43tol6c44 --> froml7c22tol7c27 | |
froml8c22tol8c26 --> froml8c27tol8c33 | |
froml3c10tol10c11 -- 4 --> froml8c22tol8c26 | |
froml7c22tol7c27 --> froml8c22tol8c26 | |
froml3c10tol10c11 -- default --> froml9c23tol9c31 | |
froml2c10tol2c20 --> froml3c10tol10c11 | |
froml8c27tol8c33 --> froml11c10tol11c25 | |
froml11c10tol11c25 --> froml12c10tol12c23 | |
end | |
" | |
Difference: | |
- Expected | |
+ Received | |
graph TD | |
- subgraph gogo | |
- statementfroml2c10tol2c20("let y = 9;") | |
- statementfroml3c10tol10c11{"switch x "} | |
- statementfroml4c22tol4c46>"throw new Error('coco');"] | |
- style statementfroml4c22tol4c46 fill:#FF9999 | |
- statementfroml5c22tol5c31>"return 1;"] | |
- style statementfroml5c22tol5c31 fill:#99FF99 | |
- statementfroml6c22tol6c33("const a = 98;") | |
- statementfroml6c33tol6c42>"return 3;"] | |
- style statementfroml6c33tol6c42 fill:#99FF99 | |
- statementfroml6c43tol6c44["Empty statement at line 6 column 43"] | |
- statementfroml7c22tol7c27("y = 5;") | |
- statementfroml8c22tol8c26("y = 9;") | |
- statementfroml8c27tol8c33["break;"] | |
- statementfroml9c23tol9c31>"return 4;"] | |
- style statementfroml9c23tol9c31 fill:#99FF99 | |
- statementfroml11c10tol11c25("console.log(y);") | |
- statementfroml12c10tol12c23>"return y + 1;"] | |
- style statementfroml12c10tol12c23 fill:#99FF99 | |
- statementfroml3c10tol10c11 -- 0 --> statementfroml4c22tol4c46 | |
- statementfroml3c10tol10c11 -- 1 --> statementfroml5c22tol5c31 | |
- statementfroml6c22tol6c33 --> statementfroml6c33tol6c42 | |
- statementfroml3c10tol10c11 -- 2 --> statementfroml6c22tol6c33 | |
- statementfroml3c10tol10c11 -- 3 --> statementfroml7c22tol7c27 | |
- statementfroml6c43tol6c44 --> statementfroml7c22tol7c27 | |
- statementfroml8c22tol8c26 --> statementfroml8c27tol8c33 | |
- statementfroml3c10tol10c11 -- 4 --> statementfroml8c22tol8c26 | |
- statementfroml7c22tol7c27 --> statementfroml8c22tol8c26 | |
- statementfroml3c10tol10c11 -- default --> statementfroml9c23tol9c31 | |
- statementfroml2c10tol2c20 --> statementfroml3c10tol10c11 | |
- statementfroml8c27tol8c33 --> statementfroml11c10tol11c25 | |
- statementfroml11c10tol11c25 --> statementfroml12c10tol12c23 | |
+ subgraph function gogo | |
+ froml2c10tol2c20("let y = 9;") | |
+ froml3c10tol10c11{"switch x "} | |
+ froml4c22tol4c46>"throw new Error('coco');"] | |
+ style froml4c22tol4c46 fill:#FF9999 | |
+ froml5c22tol5c31>"return 1;"] | |
+ style froml5c22tol5c31 fill:#99FF99 | |
+ froml6c22tol6c33("const a = 98;") | |
+ froml6c33tol6c42>"return 3;"] | |
+ style froml6c33tol6c42 fill:#99FF99 | |
+ froml6c43tol6c44["Empty statement at line 6 column 43"] | |
+ froml7c22tol7c27("y = 5;") | |
+ froml8c22tol8c26("y = 9;") | |
+ froml8c27tol8c33["break;"] | |
+ froml9c23tol9c31>"return 4;"] | |
+ style froml9c23tol9c31 fill:#99FF99 | |
+ froml11c10tol11c25("console.log(y);") | |
+ froml12c10tol12c23>"return y + 1;"] | |
+ style froml12c10tol12c23 fill:#99FF99 | |
+ froml3c10tol10c11 -- 0 --> froml4c22tol4c46 | |
+ froml3c10tol10c11 -- 1 --> froml5c22tol5c31 | |
+ froml6c22tol6c33 --> froml6c33tol6c42 | |
+ froml3c10tol10c11 -- 2 --> froml6c22tol6c33 | |
+ froml3c10tol10c11 -- 3 --> froml7c22tol7c27 | |
+ froml6c43tol6c44 --> froml7c22tol7c27 | |
+ froml8c22tol8c26 --> froml8c27tol8c33 | |
+ froml3c10tol10c11 -- 4 --> froml8c22tol8c26 | |
+ froml7c22tol7c27 --> froml8c22tol8c26 | |
+ froml3c10tol10c11 -- default --> froml9c23tol9c31 | |
+ froml2c10tol2c20 --> froml3c10tol10c11 | |
+ froml8c27tol8c33 --> froml11c10tol11c25 | |
+ froml11c10tol11c25 --> froml12c10tol12c23 | |
end | |
194 | // console.log(res); | |
195 | | |
> 196 | expect(res).toEqual(`graph TD | |
| ^ | |
197 | | |
198 | subgraph gogo | |
199 | statementfroml2c10tol2c20("let y = 9;") | |
at Object.toEqual (index.test.js:196:15) | |
PASS ./parser.test.js | |
FAIL docs-source/src/App.test.js | |
● Test suite failed to run | |
/Users/Carlos/Projects/open-source/code-to-graph/docs-source/src/App.test.js: Unexpected token (7:18) | |
Jest encountered an unexpected token | |
This usually means that you are trying to import a file which Jest cannot parse, e.g. it's not plain JavaScript. | |
By default, if Jest sees a Babel config, it will use that to transform your files, ignoring "node_modules". | |
Here's what you can do: | |
• To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config. | |
• If you need a custom transformation specify a "transform" option in your config. | |
• If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option. | |
You'll find more details and examples of these config options in the docs: | |
https://jestjs.io/docs/en/configuration.html | |
Details: | |
5 | it('renders without crashing', () => { | |
6 | const div = document.createElement('div'); | |
> 7 | ReactDOM.render(<App />, div); | |
| ^ | |
8 | ReactDOM.unmountComponentAtNode(div); | |
9 | }); | |
10 | | |
Test Suites: 2 failed, 1 passed, 3 total | |
Tests: 9 failed, 8 passed, 17 total | |
Snapshots: 8 passed, 8 total | |
Time: 3.138s | |
Ran all test suites. | |
error Command failed with exit code 1. | |
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. | |
➜ code-to-graph git:(master) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment