MCPcopy Create free account
hub / github.com/bytecodealliance/ComponentizeJS / test

Function test

test/cases/resource-with-lists/test.js:3–18  ·  view source on GitHub ↗
(instance)

Source from the content-addressed store, hash-verified

1import { deepStrictEqual } from 'node:assert'
2
3export function test(instance) {
4 const { Thing } = instance.resourceWithLists
5
6 let encoder = new TextEncoder()
7
8 let thing1 = new Thing(encoder.encode("Hi"))
9
10 deepStrictEqual(thing1.foo(), encoder.encode("Hi Thing HostThing HostThing.foo Thing.foo"))
11
12 thing1.bar(encoder.encode("Hola"))
13
14 deepStrictEqual(thing1.foo(), encoder.encode("Hola Thing.bar HostThing.bar HostThing.foo Thing.foo"))
15
16 deepStrictEqual(Thing.baz(encoder.encode("Ohayo Gozaimas")),
17 encoder.encode("Ohayo Gozaimas Thing.baz HostThing.baz Thing.baz again"))
18}
19

Callers

nothing calls this directly

Calls 3

fooMethod · 0.95
barMethod · 0.95
bazMethod · 0.45

Tested by

no test coverage detected