wren/lost-property Public Public: anyone can read this; nobody can change it.
workbenchthis machine
Files f49019d01ab3fddf8647e04e239d95edb37aeac5
| 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 | }); |