| ... | ... | @@ -1,36 +0,0 @@ |
| 1 | | import { describe, expect, it, vi } from "vite-plus/test"; |
| 2 | | |
| 3 | | import { makeQueuedMessageMetadata, makeTurnCommandMetadata } from "./commandMetadata"; |
| 4 | | |
| 5 | | vi.mock("expo-crypto", () => ({ |
| 6 | | randomUUID: () => crypto.randomUUID(), |
| 7 | | })); |
| 8 | | |
| 9 | | describe("mobile command metadata", () => { |
| 10 | | it("creates ids and timestamps for thread starts", () => { |
| 11 | | const metadata = makeTurnCommandMetadata(); |
| 12 | | |
| 13 | | expect(metadata.commandId).toMatch( |
| 14 | | /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/, |
| 15 | | ); |
| 16 | | expect(metadata.messageId).toMatch( |
| 17 | | /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/, |
| 18 | | ); |
| 19 | | expect(metadata.threadId).toMatch( |
| 20 | | /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/, |
| 21 | | ); |
| 22 | | expect(metadata.createdAt).toMatch(/^\d{4}-\d{2}-\d{2}T/); |
| 23 | | }); |
| 24 | | |
| 25 | | it("creates ids and timestamps for queued messages", () => { |
| 26 | | const metadata = makeQueuedMessageMetadata(); |
| 27 | | |
| 28 | | expect(metadata.commandId).toMatch( |
| 29 | | /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/, |
| 30 | | ); |
| 31 | | expect(metadata.messageId).toMatch( |
| 32 | | /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/, |
| 33 | | ); |
| 34 | | expect(metadata.createdAt).toMatch(/^\d{4}-\d{2}-\d{2}T/); |
| 35 | | }); |
| 36 | | }); |