| 2275 | } |
| 2276 | |
| 2277 | func TestInvalidJavascriptFunctions(t *testing.T) { |
| 2278 | testCases := []struct { |
| 2279 | Name string |
| 2280 | SyncFunction *string |
| 2281 | ImportFilter *string |
| 2282 | ExpectErrorCount int |
| 2283 | ExpectSyncFunction *string |
| 2284 | ExpectImportFilter *string |
| 2285 | }{ |
| 2286 | { |
| 2287 | "Both nil", |
| 2288 | nil, |
| 2289 | nil, |
| 2290 | 0, |
| 2291 | nil, |
| 2292 | nil, |
| 2293 | }, |
| 2294 | { |
| 2295 | "Valid Sync Fn No Import", |
| 2296 | base.Ptr(`function(){}`), |
| 2297 | nil, |
| 2298 | 0, |
| 2299 | base.Ptr(`function(){}`), |
| 2300 | nil, |
| 2301 | }, |
| 2302 | { |
| 2303 | "Valid Import Fn No Sync", |
| 2304 | nil, |
| 2305 | base.Ptr(`function(){}`), |
| 2306 | 0, |
| 2307 | nil, |
| 2308 | base.Ptr(`function(){}`), |
| 2309 | }, |
| 2310 | { |
| 2311 | "Both empty", |
| 2312 | base.Ptr(``), |
| 2313 | base.Ptr(``), |
| 2314 | 0, |
| 2315 | nil, |
| 2316 | nil, |
| 2317 | }, |
| 2318 | { |
| 2319 | "Both blank", |
| 2320 | base.Ptr(` `), |
| 2321 | base.Ptr(` `), |
| 2322 | 0, |
| 2323 | nil, |
| 2324 | nil, |
| 2325 | }, |
| 2326 | { |
| 2327 | "Invalid Sync Fn No Import", |
| 2328 | base.Ptr(`function(){`), |
| 2329 | nil, |
| 2330 | 1, |
| 2331 | nil, |
| 2332 | nil, |
| 2333 | }, |
| 2334 | { |