MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / TestInvalidJavascriptFunctions

Function TestInvalidJavascriptFunctions

rest/config_test.go:2277–2393  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

2275}
2276
2277func 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 {

Callers

nothing calls this directly

Calls 8

validateMethod · 0.95
PtrFunction · 0.92
TestCtxFunction · 0.92
SafeDatabaseNameFunction · 0.85
RunMethod · 0.65
LenMethod · 0.65
EqualMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected