Address workspace routine review feedback

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
DottaandPaperclip committed 2026-07-01 23:31:05 +00:00
1 parent 0260fab2f5
commit a2fb612e8c
3 files changed
+20 -4

No files matched your search

+15
View File
@@ -139,4 +139,19 @@ describe("workspace routine helpers", () => {
otherWorkspaces: [noProjectRoutine, otherProjectRoutine],
});
});
it("does not treat company-wide routines as current-workspace routines when the workspace has no project", () => {
const noProjectRoutine = createRoutine({
id: "routine-no-project",
projectId: null,
variables: [
{ name: "workspaceBranch", label: null, type: "text", defaultValue: null, required: true, options: [] },
],
});
expect(groupWorkspaceSpecificRoutines([noProjectRoutine], null)).toEqual({
thisWorkspace: [],
otherWorkspaces: [noProjectRoutine],
});
});
});
+1 -1
View File
@@ -55,7 +55,7 @@ export function groupWorkspaceSpecificRoutines(
for (const routine of routines) {
if (!routineHasWorkspaceSpecificVariables(routine)) continue;
if (routine.projectId === currentProjectId) {
if (currentProjectId !== null && routine.projectId === currentProjectId) {
groups.thisWorkspace.push(routine);
} else {
groups.otherWorkspaces.push(routine);
@@ -237,12 +237,13 @@ async function flush() {
await new Promise((resolve) => setTimeout(resolve, 0));
}
async function waitForCondition(condition: () => boolean) {
for (let index = 0; index < 20; index += 1) {
async function waitForCondition(condition: () => boolean, timeoutMs = 2000) {
const startedAt = Date.now();
while (Date.now() - startedAt < timeoutMs) {
if (condition()) return;
await flush();
}
expect(condition()).toBe(true);
expect(condition(), `condition did not become true within ${timeoutMs}ms`).toBe(true);
}
describe("ExecutionWorkspaceDetail plugin slots", () => {