整理测试代码并清理文档引用

This commit is contained in:
Cheng Zhou
2026-06-22 17:27:11 +08:00
parent 6056c8364a
commit c351ca59c4
75 changed files with 15 additions and 4415 deletions
@@ -1,28 +0,0 @@
import { describe, expect, it } from "vitest";
import { readFileSync } from "node:fs";
import { resolve } from "node:path";
const readSubjectEditorDrawer = () => readFileSync(resolve(__dirname, "./SubjectEditorDrawer.vue"), "utf8");
describe("SubjectEditorDrawer screening date editing", () => {
it("keeps screening date editable when editing an existing participant", () => {
const source = readSubjectEditorDrawer();
const screeningDateField = source.slice(
source.indexOf('v-model="form.screening_date"'),
source.indexOf('v-model="form.consent_date"')
);
expect(screeningDateField).toContain(':disabled="isReadOnly"');
expect(screeningDateField).not.toContain(':disabled="isEdit || isReadOnly"');
});
it("submits screening date in the edit payload", () => {
const source = readSubjectEditorDrawer();
const editPayload = source.slice(
source.indexOf("await updateSubject(studyId.value, props.subjectId, {"),
source.indexOf("});", source.indexOf("await updateSubject(studyId.value, props.subjectId, {"))
);
expect(editPayload).toContain("screening_date: form.screening_date || null");
});
});
@@ -1,28 +0,0 @@
import { describe, expect, it } from "vitest";
import { readFileSync } from "node:fs";
import { resolve } from "node:path";
const readSubjectForm = () => readFileSync(resolve(__dirname, "./SubjectForm.vue"), "utf8");
describe("SubjectForm screening date editing", () => {
it("keeps screening date editable when editing an existing participant", () => {
const source = readSubjectForm();
const screeningDateField = source.slice(
source.indexOf('v-model="form.screening_date"'),
source.indexOf('v-model="form.consent_date"')
);
expect(screeningDateField).toContain(':disabled="isReadOnly"');
expect(screeningDateField).not.toContain(':disabled="isEdit || isReadOnly"');
});
it("submits screening date in the edit payload", () => {
const source = readSubjectForm();
const editPayload = source.slice(
source.indexOf("const payload = {"),
source.indexOf("};", source.indexOf("const payload = {"))
);
expect(editPayload).toContain("screening_date: form.screening_date || null");
});
});