feat(studio): add thirteen presets and preview reviewed proposals
This commit is contained in:
1 parent
ba752e556d
commit
c765d76a06
12 files changed
+331
-19
No files matched your search
@@ -202,6 +202,51 @@ test("provider adapter uses bounded patches, compact capabilities and one repair
|
||||
expect(context).toContain("Repair these diagnostics");
|
||||
});
|
||||
|
||||
test("empty drafts require flat typed tokens and reject nested color groups before repair", async () => {
|
||||
const system = {
|
||||
schemaVersion: 1 as const,
|
||||
id: "empty",
|
||||
name: "Empty",
|
||||
version: "1.0.0",
|
||||
tokens: {},
|
||||
};
|
||||
let calls = 0;
|
||||
const batch = await generateDesigns(await request("directions", [], system), {
|
||||
provider: {
|
||||
name: "fixture",
|
||||
async generate(_prompt, options) {
|
||||
calls++;
|
||||
expect(options!.system).toContain("Token maps are FLAT");
|
||||
expect(options!.system).toContain("COMPLETE token object");
|
||||
return {
|
||||
provider: "fixture",
|
||||
value: JSON.stringify({
|
||||
alternatives: ["#002FA7", "#00642C", "#A32957"].map((color, index) => ({
|
||||
name: `Direction ${index}`,
|
||||
rationale: "A distinct brand color.",
|
||||
patch: [
|
||||
calls === 1
|
||||
? set("/tokens/color", { primary: { type: "color", value: color } })
|
||||
: set("/tokens/color.primary", {
|
||||
type: "color",
|
||||
value: color,
|
||||
legacy: "color-primary",
|
||||
}),
|
||||
],
|
||||
})),
|
||||
}),
|
||||
};
|
||||
},
|
||||
},
|
||||
});
|
||||
expect(calls).toBe(2);
|
||||
expect(batch.alternatives).toHaveLength(3);
|
||||
expect(batch.diagnostics).toEqual([]);
|
||||
for (const alternative of batch.alternatives)
|
||||
expect(validateDesignSystem(alternative.system)).toEqual([]);
|
||||
expect(system.tokens).toEqual({});
|
||||
});
|
||||
|
||||
test("provider invalid parts and lock violations cannot survive bounded repair", async () => {
|
||||
let calls = 0;
|
||||
const provider: GenerationProvider = {
|
||||
|
||||
Reference in new issue
Block a user