Conformance
The check every adapter passes before it ships.
@owlf/core/testkit checks an adapter against its fixture. It runs in Bun or Node.
import { expect, test } from "bun:test";
import { join } from "node:path";
import { checkAdapter, loadFixture } from "@owlf/core/testkit";
import { myApp } from ".";
const files = loadFixture(join(import.meta.dir, "../fixtures"));
test("conforms to OWLF", async () => {
expect(await checkAdapter(myApp, files)).toEqual([]);
});
checkAdapter returns a list of problems, empty when the adapter conforms:
detectscores its own fixture at least 0.5.parsewrites a document that passesvalidateDocument.source.appequals the adapter id.- The fixture produces entries.
- The fixture covers every mood position, when the app has mood.
- The fixture covers exactly the declared
modules: each one in at least one entry, no other.
The OWLF repository also checks that every adapter detects its own fixture as the best match, and that detect never throws on damaged files.
Fixture checklist
- every mood position, plus an entry without mood if the app allows it
- 2 entries on one day, one at 23:30, one backfilled
- grouped and ungrouped tags, emotions, sleep, people, a photo
- a note with emoji, umlauts and line breaks; title and prompts if the app has them
- every declared module, and no other