Organize Seal modules and add guarded rule recoding
This commit is contained in:
1 parent
f788f9c6db
commit
8c7cb219a0
65 files changed
+837
-131
No files matched your search
@@ -355,6 +355,10 @@ describe("corps sync-test", () => {
|
||||
expect(createdRules.length).toBe(2);
|
||||
expect((createdRules[0]!.body as any).description).toBe("Production Rule A");
|
||||
expect((createdRules[1]!.body as any).description).toBe("Production Rule B");
|
||||
const resetIndex = requests.findIndex(r => r.path === "/api/v1/rules/batch-recode");
|
||||
const firstCreateIndex = requests.findIndex(r => r.method === "POST" && r.path === "/api/v1/rules");
|
||||
expect(resetIndex).toBeGreaterThanOrEqual(0);
|
||||
expect(resetIndex).toBeLessThan(firstCreateIndex);
|
||||
|
||||
const publishVersion = requests.find((r) => r.method === "POST" && r.path === "/api/v1/rule-set-versions/publish");
|
||||
expect(publishVersion).toBeDefined();
|
||||
@@ -909,6 +913,9 @@ describe("corps replay-test", () => {
|
||||
function mockSealSyncRequests(options: {
|
||||
onMutation?: (method: string, path: string, body?: unknown) => void;
|
||||
} = {}) {
|
||||
let remainingTestRules = [
|
||||
{ id: "test-rule-old", description: "Old test rule", scope: "global", strictness: "strict" }
|
||||
];
|
||||
globalThis.fetch = (async (input: RequestInfo | URL, init?: RequestInit) => {
|
||||
const requestUrl = typeof input === "string"
|
||||
? input
|
||||
@@ -1071,9 +1078,7 @@ function mockSealSyncRequests(options: {
|
||||
} else {
|
||||
return jsonResponse({
|
||||
data: {
|
||||
rules: [
|
||||
{ id: "test-rule-old", description: "Old test rule", scope: "global", strictness: "strict" }
|
||||
],
|
||||
rules: remainingTestRules,
|
||||
hasPendingDeletes: false
|
||||
}
|
||||
});
|
||||
@@ -1082,6 +1087,7 @@ function mockSealSyncRequests(options: {
|
||||
|
||||
if (url.pathname.startsWith("/api/v1/rules/") && method === "DELETE") {
|
||||
options.onMutation?.("DELETE", url.pathname);
|
||||
remainingTestRules = remainingTestRules.filter(rule => rule.id !== url.pathname.split("/").pop());
|
||||
return jsonResponse({ data: { success: true } });
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user