MCPcopy
hub / github.com/pocketbase/pocketbase / TestLoadingDynamicModel

Function TestLoadingDynamicModel

plugins/jsvm/binds_test.go:1188–1287  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1186}
1187
1188func TestLoadingDynamicModel(t *testing.T) {
1189 app, _ := tests.NewTestApp()
1190 defer app.Cleanup()
1191
1192 vm := goja.New()
1193 BindCore(vm)
1194 BindDbx(vm)
1195 vm.Set("$app", app)
1196
1197 _, err := vm.RunString(`
1198 let result = new DynamicModel({
1199 string: "",
1200 nullString: nullString(),
1201 nullStringEmpty: nullString(),
1202
1203 bool: false,
1204 nullBool: nullBool(),
1205 nullBoolEmpty: nullBool(),
1206
1207 int: 0,
1208 nullInt: nullInt(),
1209 nullIntEmpty: nullInt(),
1210
1211 float: -0,
1212 nullFloat: nullFloat(),
1213 nullFloatEmpty: nullFloat(),
1214
1215 array: [],
1216 nullArray: nullArray(),
1217 nullArrayEmpty: nullArray(),
1218
1219 object: {},
1220 nullObject: nullObject(),
1221 nullObjectEmpty: nullObject(),
1222 })
1223
1224 const expectations = {
1225 "string": "a",
1226 "nullString": "b",
1227 "nullStringEmpty": null,
1228
1229 "bool": false,
1230 "nullBool": true,
1231 "nullBoolEmpty": null,
1232
1233 "int": 1,
1234 "nullInt": 2,
1235 "nullIntEmpty": null,
1236
1237 "float": 1.1,
1238 "nullFloat": 1.2,
1239 "nullFloatEmpty": null,
1240
1241 "array": [1,2],
1242 "nullArray": [3,4],
1243 "nullArrayEmpty": null,
1244
1245 "object": {a:1},

Callers

nothing calls this directly

Calls 5

CleanupMethod · 0.95
NewTestAppFunction · 0.92
BindCoreFunction · 0.85
BindDbxFunction · 0.85
SetMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…