feat(recipe): add step quantities and appliance settings
Release Drafter / auto_label (push) Skipped
Release Drafter / draft_release (push) Canceled after 0s
CodeQL / Analyze (javascript-typescript) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
Backend Lint and Test / tests (sqlite) (push) Canceled after 0s
Backend Lint and Test / tests (postgres) (push) Canceled after 0s
Docker Nightly Production / Backend Server Tests (push) Canceled after 0s
Frontend Lint and Test / lint (push) Canceled after 0s
Docker Nightly Production / Frontend Tests (push) Canceled after 0s
Build Package / Build frontend and wheel (push) Canceled after 0s
Docker Nightly Production / Build Package (push) Canceled after 0s
Docker Nightly Production / Build E2E Image Cache (push) Canceled after 0s
Docker Nightly Production / Build Tagged Release (push) Canceled after 0s
Docker Nightly Production / Notify Discord (push) Canceled after 0s
Release Drafter / auto_label (push) Skipped
Release Drafter / draft_release (push) Canceled after 0s
CodeQL / Analyze (javascript-typescript) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
Backend Lint and Test / tests (sqlite) (push) Canceled after 0s
Backend Lint and Test / tests (postgres) (push) Canceled after 0s
Docker Nightly Production / Backend Server Tests (push) Canceled after 0s
Frontend Lint and Test / lint (push) Canceled after 0s
Docker Nightly Production / Frontend Tests (push) Canceled after 0s
Build Package / Build frontend and wheel (push) Canceled after 0s
Docker Nightly Production / Build Package (push) Canceled after 0s
Docker Nightly Production / Build E2E Image Cache (push) Canceled after 0s
Docker Nightly Production / Build Tagged Release (push) Canceled after 0s
Docker Nightly Production / Notify Discord (push) Canceled after 0s
This commit is contained in:
1 parent
1dd63a070b
commit
8dad430650
51 files changed
+2775
-77
No files matched your search
@@ -0,0 +1,49 @@
|
||||
import { mount } from "@vue/test-utils";
|
||||
import { describe, expect, test } from "vitest";
|
||||
import { createVuetify } from "vuetify";
|
||||
import * as components from "vuetify/components";
|
||||
import * as directives from "vuetify/directives";
|
||||
import RecipeStepAllocationEditor from "./RecipeStepAllocationEditor.vue";
|
||||
|
||||
describe("allocation intent editor", () => {
|
||||
test("does not change legacy quantities on mount and never infers scale activation", () => {
|
||||
const wrapper = mount(RecipeStepAllocationEditor, {
|
||||
props: { modelValue: { referenceId: "flour", quantity: null } },
|
||||
global: { plugins: [createVuetify({ components, directives })] },
|
||||
});
|
||||
expect(wrapper.findComponent(components.VSelect).props("modelValue")).toBe("full");
|
||||
expect(wrapper.emitted("update:modelValue")).toBeUndefined();
|
||||
});
|
||||
|
||||
test("selects unknown safely and retains the association identity", async () => {
|
||||
const wrapper = mount(RecipeStepAllocationEditor, {
|
||||
props: { modelValue: { allocationId: "allocation", referenceId: "flour", quantity: 20, weighing: "weigh" } },
|
||||
global: { plugins: [createVuetify({ components, directives })] },
|
||||
});
|
||||
await wrapper.findComponent(components.VSelect).vm.$emit("update:modelValue", "unknown");
|
||||
expect(wrapper.emitted("update:modelValue")?.at(-1)).toEqual([{
|
||||
allocationId: "allocation", referenceId: "flour", quantity: 0, quantityKind: "unknown", weighing: "unspecified",
|
||||
}]);
|
||||
});
|
||||
|
||||
test("edits partial portions and weighing independently", async () => {
|
||||
const wrapper = mount(RecipeStepAllocationEditor, {
|
||||
props: { modelValue: { allocationId: "allocation", referenceId: "flour", quantityKind: "partial", quantity: 0 } },
|
||||
global: { plugins: [createVuetify({ components, directives })] },
|
||||
});
|
||||
await wrapper.findComponent(components.VNumberInput).vm.$emit("update:modelValue", 0.5);
|
||||
expect(wrapper.emitted("update:modelValue")?.at(-1)?.[0]).toMatchObject({ quantity: 0.5, quantityKind: "partial" });
|
||||
const weighing = wrapper.findAllComponents(components.VSelect)[1]!;
|
||||
await weighing.vm.$emit("update:modelValue", "manual");
|
||||
expect(wrapper.emitted("update:modelValue")?.at(-1)?.[0]).toMatchObject({ quantity: 0, weighing: "manual" });
|
||||
});
|
||||
|
||||
test("requires a portion to be entered when an unknown amount is changed to partial", async () => {
|
||||
const wrapper = mount(RecipeStepAllocationEditor, {
|
||||
props: { modelValue: { referenceId: "flour", quantityKind: "unknown", quantity: 0 } },
|
||||
global: { plugins: [createVuetify({ components, directives })] },
|
||||
});
|
||||
await wrapper.findComponent(components.VSelect).vm.$emit("update:modelValue", "partial");
|
||||
expect(wrapper.emitted("update:modelValue")?.at(-1)?.[0]).toMatchObject({ quantityKind: "partial", quantity: null });
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user