forked from EduCraft/curriculum-project-hub
fix: bootstrap fresh alpha silo
This commit is contained in:
@@ -18,6 +18,21 @@ const input = {
|
||||
describe("Alpha Silo bootstrap", () => {
|
||||
beforeEach(async () => {
|
||||
await prisma.$executeRawUnsafe(`TRUNCATE TABLE "Organization" RESTART IDENTITY CASCADE`);
|
||||
await prisma.organization.create({
|
||||
data: {
|
||||
id: "org_default",
|
||||
slug: "legacy-default",
|
||||
name: "Legacy Default Organization",
|
||||
projectSettings: { create: { membersCanCreateProjects: true } },
|
||||
folders: {
|
||||
create: {
|
||||
id: "folder_inbox_2b99350e0db97ad0cbcb55c20ee8bafa",
|
||||
name: "Inbox",
|
||||
sortKey: "000000",
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
@@ -54,4 +69,21 @@ describe("Alpha Silo bootstrap", () => {
|
||||
});
|
||||
await expect(requireSiloOrganization(prisma, "org_other")).rejects.toThrow("Silo Organization mismatch");
|
||||
});
|
||||
|
||||
it("does not delete a legacy migration Organization that contains tenant data", async () => {
|
||||
await prisma.project.create({
|
||||
data: {
|
||||
organizationId: "org_default",
|
||||
folderId: "folder_inbox_2b99350e0db97ad0cbcb55c20ee8bafa",
|
||||
name: "Legacy Project",
|
||||
workspaceDir: "legacy-project",
|
||||
},
|
||||
});
|
||||
|
||||
await expect(bootstrapAlphaSilo(prisma, testSecretEnvelope, input, {
|
||||
feishu: async () => {},
|
||||
provider: async () => {},
|
||||
})).rejects.toThrow("bootstrap database is not the configured single-Organization Silo");
|
||||
await expect(prisma.organization.findUnique({ where: { id: "org_default" } })).resolves.not.toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user