JavaScript tests¶
60 tests over the two files no C# test can reach: the WebGL jslib bridge, and the page helper injected into index.html.
No dependencies, no Unity, no licence. They run first in CI for exactly that reason — if the bridge is broken there is no point spending ten minutes pulling a 10 GB editor image.
| File | Covers | Count |
|---|---|---|
bridge.test.mjs | API discovery, the two-call string read, error passthrough | 13 |
standards.test.mjs | Per-standard element names and method names, 1.2 and 2004 | 32 |
injector.test.mjs | The injected page helper and its API proxy | 15 |
harness.mjs | The runner and the fake API objects | — |
The fakes are the interesting part¶
harness.mjs builds fake LMS API objects for the tests to run against, and some of them are deliberately awkward:
makeStatefulApi()keeps its state in aWeakMapkeyed on the receiver.makeShadowingApi()keeps it inthis.ErrorNumber.
Both exist because the first regression test written for the API-proxy bug did not reproduce it. The original fake held its state in a closure, which is reachable however the method is called — so a proxy that lost this still passed. The bug only appears when the method's state depends on the receiver, which is what a real LMS adapter does.
That bug made ILmsRuntime.LastError report "no error" for an entire live session on SCORM Cloud, in the default configuration. Worth remembering when writing the next fake: a fake that is easier to satisfy than the real thing tests nothing.
What they cannot tell you¶
These prove the bridge speaks the standards correctly. They cannot prove an LMS agrees — platforms differ on completion, success, attempts and bookmarking, and not always in documented ways.
That is what ../CONFORMANCE.md is for, and both defects it found were invisible here.