@supatype/cli 0.3.5 → 0.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -600,6 +600,42 @@ export type Config = Model<{
600
600
  expect(config?.options.singleton).toBe(true)
601
601
  })
602
602
 
603
+ it("carries a model's label overrides to the engine as options", () => {
604
+ // Presentation only: the engine passes these to Studio, which otherwise inflects the type
605
+ // name and cannot know that "Places of Interest" has its noun first.
606
+ const dir = mkdtempSync(join(tmpdir(), "supatype-model-labels-"))
607
+ dirs.push(dir)
608
+ const schemaPath = join(dir, "schema.ts")
609
+ writeFileSync(
610
+ schemaPath,
611
+ `
612
+ import type { Model, UUID, Public } from "@supatype/types"
613
+
614
+ export type PlacesOfInterest = Model<{
615
+ id: UUID
616
+ }, {
617
+ label: "Place of Interest"
618
+ labelPlural: "Places of Interest"
619
+ access: { read: Public }
620
+ }>
621
+
622
+ export type Post = Model<{
623
+ id: UUID
624
+ }, {
625
+ access: { read: Public }
626
+ }>
627
+ `,
628
+ "utf8",
629
+ )
630
+
631
+ const ast = extractSchemaAstFromTypes(schemaPath, dir)
632
+ const places = ast?.models.find((m) => m.name === "PlacesOfInterest")
633
+ expect(places?.options).toMatchObject({ label: "Place of Interest", labelPlural: "Places of Interest" })
634
+ const post = ast?.models.find((m) => m.name === "Post")
635
+ expect(post?.options).not.toHaveProperty("label")
636
+ expect(post?.options).not.toHaveProperty("labelPlural")
637
+ })
638
+
603
639
  it("infers timestamps from WithTimestamps wrapper", () => {
604
640
  const dir = mkdtempSync(join(tmpdir(), "supatype-timestamps-"))
605
641
  dirs.push(dir)