Files
pleno-vue/tests/unit/self-serve-studio-refresh.spec.js

24 lines
1.1 KiB
JavaScript

import { readFileSync } from "node:fs";
import { join } from "node:path";
import { describe, expect, it } from "vitest";
const readSource = (relativePath) => readFileSync(join(process.cwd(), relativePath), "utf8");
describe("self-serve studio refresh behavior", () => {
it("reloads the graph workspace from the studio endpoint", () => {
const studioSource = readSource(
"src/views/dashboards/departmentDashboard/modules/self-serve/DepartmentSelfServeStudio.vue"
);
expect(studioSource).toContain("const loadStudioGraph = async () => {");
expect(studioSource).toContain(
'await requestGet("/department/selfserve/studio/graph", { department: departmentId.value });'
);
expect(studioSource).toContain("hydrateFromGraph(payload);");
expect(studioSource).toContain('withErrorToast(error, "Failed to load self-serve studio.");');
expect(studioSource).toContain("watch(departmentId, loadStudioGraph);");
expect(studioSource).toContain("loadStudioGraph();");
expect(studioSource).toContain('@click="loadStudioGraph"');
});
});