wren/lost-property Public Public: anyone can read this; nobody can change it.

workbenchthis machine
Files d66e67826a76bd71f7b0790b198ae93f73fe1614
24 lines · 1.2 KB · ~354 tok Raw History
1
import { expect, test } from "bun:test";
2
import { catalogueNumber, conditionOf, vitrineOf, VITRINES } from "./museum.ts";
3
4
test("sorts a description into its vitrine by keyword", () => {
5
  expect(VITRINES[vitrineOf("a single brown leather glove")]).toBe("Outerwear and Umbrellas");
6
  expect(VITRINES[vitrineOf("a set of house keys on a red fob")]).toBe("Keys and Fastenings");
7
  expect(VITRINES[vitrineOf("reading glasses, tortoiseshell frame")]).toBe("Spectacles and Lenses");
8
  expect(VITRINES[vitrineOf("an iphone charger, white")]).toBe("Small Electronics");
9
  expect(VITRINES[vitrineOf("a silver ring, engraved")]).toBe("Jewellery and Adornment");
10
  expect(VITRINES[vitrineOf("a paperback book, dog-eared")]).toBe("Papers and Correspondence");
11
  expect(VITRINES[vitrineOf("a stuffed teddy bear")]).toBe("Children's Effects");
12
});
13
14
test("falls back to Miscellanea when nothing matches", () => {
15
  expect(VITRINES[vitrineOf("a smooth grey stone")]).toBe("Miscellanea");
16
});
17
18
test("gives the same item the same condition every time", () => {
19
  expect(conditionOf(7)).toBe(conditionOf(7));
20
});
21
22
test("builds a catalogue number from the year and id", () => {
23
  expect(catalogueNumber(3, "2026-09-14 10:00:00")).toBe("LP 2026.0003");
24
});
↑↓ navigate ↵ open esc close
↑↓ navigate ↵ open esc close

Keyboard shortcuts