@@ -39,12 +39,12 @@ const convertUtf8ToBase64 = (str: string): string => {
39
39
*/
40
40
export const createMermaidUrl = (
41
41
diagramStr : string ,
42
- options ? : CypressMermaidConfig ,
43
- api ? : boolean
42
+ options : CypressMermaidConfig = { } ,
43
+ api : boolean = false
44
44
) : string => {
45
45
const codeObject : CodeObject = {
46
46
code : diagramStr ,
47
- mermaid : options || { } ,
47
+ mermaid : options ,
48
48
} ;
49
49
const objStr : string = JSON . stringify ( codeObject ) ;
50
50
const url = `http://localhost:9000/${ api ? 'xss' : 'e2e' } .html?graph=${ convertUtf8ToBase64 (
@@ -68,14 +68,13 @@ export const createMermaidUrl = (
68
68
*/
69
69
export const openUrlAndVerifyRendering = (
70
70
url : string ,
71
- options ? : CypressMermaidConfig ,
71
+ options : CypressMermaidConfig = { } ,
72
72
validation ?: any
73
73
) : void => {
74
74
const useAppli : boolean = Cypress . env ( 'useAppli' ) ;
75
- const name : string = ( ( options && options . name ) || cy . state ( 'runnable' ) . fullTitle ( ) ) . replace (
76
- / \s + / g,
77
- '-'
78
- ) ;
75
+ const name : string = (
76
+ options && options . name ? options . name : cy . state ( 'runnable' ) . fullTitle ( )
77
+ ) . replace ( / \s + / g, '-' ) ;
79
78
80
79
if ( useAppli ) {
81
80
cy . log ( `Opening eyes ${ Cypress . spec . name } --- ${ name } ` ) ;
@@ -114,8 +113,8 @@ export const openUrlAndVerifyRendering = (
114
113
*/
115
114
export const imgSnapshotTest = (
116
115
diagramStr : string ,
117
- _options ? : CypressMermaidConfig ,
118
- api ? : boolean ,
116
+ _options : CypressMermaidConfig = { } ,
117
+ api : boolean = false ,
119
118
validation ?: any
120
119
) : void => {
121
120
cy . log ( JSON . stringify ( _options ) ) ;
@@ -143,8 +142,8 @@ export const imgSnapshotTest = (
143
142
*/
144
143
export const urlSnapshotTest = (
145
144
url : string ,
146
- _options ? : CypressMermaidConfig ,
147
- _api ? : boolean ,
145
+ _options : CypressMermaidConfig = { } ,
146
+ _api : boolean = false ,
148
147
validation ?: any
149
148
) : void => {
150
149
const options : CypressMermaidConfig = Object . assign ( _options ) ;
0 commit comments