Skip to content
OWLF
Esc
↑↓navigate↵open⌘Jpreview
On this page

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:

  • detect scores its own fixture at least 0.5.
  • parse writes a document that passes validateDocument.
  • source.app equals 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

Was this page helpful?