MCPcopy Create free account
hub / github.com/pocketbase/pocketbase / TestBindCoreSubscriptionMessage

Function TestBindCoreSubscriptionMessage

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

Source from the content-addressed store, hash-verified

235}
236
237func TestBindCoreSubscriptionMessage(t *testing.T) {
238 vm := goja.New()
239 BindCore(vm)
240 vm.Set("bytesToString", func(b []byte) string {
241 return string(b)
242 })
243
244 _, err := vm.RunString(`
245 const payload = {
246 name: "test",
247 data: '{"test":123}'
248 }
249
250 const result = new SubscriptionMessage(payload);
251
252 if (result.name != payload.name) {
253 throw new("Expected name " + payload.name + ", got " + result.name);
254 }
255
256 if (bytesToString(result.data) != payload.data) {
257 throw new("Expected data '" + payload.data + "', got '" + bytesToString(result.data) + "'");
258 }
259 `)
260 if err != nil {
261 t.Fatal(err)
262 }
263}
264
265func TestBindCoreRecord(t *testing.T) {
266 app, _ := tests.NewTestApp()

Callers

nothing calls this directly

Calls 2

BindCoreFunction · 0.85
SetMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…