Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4588,20 +4588,20 @@
const yaml = await import("js-yaml");
updates = yaml.load(readFileSync(options.fromYaml, "utf-8")) as Record<string, unknown>;
} else {
if (options.name) updates.name = options.name;

Check failure on line 4591 in src/cli.ts

View workflow job for this annotation

GitHub Actions / Index Signature Strictness

Property 'name' comes from an index signature, so it must be accessed with ['name'].
if (options.description) updates.description = options.description;

Check failure on line 4592 in src/cli.ts

View workflow job for this annotation

GitHub Actions / Index Signature Strictness

Property 'description' comes from an index signature, so it must be accessed with ['description'].
if (options.heroText) updates.hero_text = options.heroText;

Check failure on line 4593 in src/cli.ts

View workflow job for this annotation

GitHub Actions / Index Signature Strictness

Property 'hero_text' comes from an index signature, so it must be accessed with ['hero_text'].
if (options.logoUrl) updates.logo_url = options.logoUrl;

Check failure on line 4594 in src/cli.ts

View workflow job for this annotation

GitHub Actions / Index Signature Strictness

Property 'logo_url' comes from an index signature, so it must be accessed with ['logo_url'].
if (options.faviconUrl) updates.favicon_url = options.faviconUrl;

Check failure on line 4595 in src/cli.ts

View workflow job for this annotation

GitHub Actions / Index Signature Strictness

Property 'favicon_url' comes from an index signature, so it must be accessed with ['favicon_url'].
if (
options.primaryColor ||
options.secondaryColor ||
options.backgroundColor ||
options.textColor
) {
updates.colors = {};

Check failure on line 4602 in src/cli.ts

View workflow job for this annotation

GitHub Actions / Index Signature Strictness

Property 'colors' comes from an index signature, so it must be accessed with ['colors'].
if (options.primaryColor)
(updates.colors as Record<string, string>).primary = options.primaryColor;

Check failure on line 4604 in src/cli.ts

View workflow job for this annotation

GitHub Actions / Index Signature Strictness

Property 'colors' comes from an index signature, so it must be accessed with ['colors'].
if (options.secondaryColor)
(updates.colors as Record<string, string>).secondary = options.secondaryColor;
if (options.backgroundColor)
Expand Down Expand Up @@ -7070,7 +7070,7 @@
return [...postItems, ...draftItems, ...broadcastItems];
}

async function enforceSchedulingFreezePolicy(options: {
export async function enforceSchedulingFreezePolicy(options: {
operation: string;
freezePolicyPath: string | undefined;
cataloguePath: string | undefined;
Expand Down
39 changes: 39 additions & 0 deletions src/test/assurance/cli-scheduling.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";
import { enforceSchedulingFreezePolicy } from "../../cli.js";
import * as policyModule from "../../policy/scheduling-freeze.js";
import * as cliModule from "../../cli.js";

vi.mock("../../policy/scheduling-freeze.js", () => {
return {
evaluateSchedulingFreezePolicy: vi.fn(),
buildSchedulingFreezeBlockReport: vi.fn(),
};
});

describe("enforceSchedulingFreezePolicy", () => {
let originalExitCode: number | undefined;

beforeEach(() => {
vi.resetAllMocks();
originalExitCode = process.exitCode;
});

afterEach(() => {
process.exitCode = originalExitCode;
});

it("should return true when missing schedule At and calendar limitations exist", async () => {
vi.mocked(policyModule.evaluateSchedulingFreezePolicy).mockResolvedValue({ allowed: true });

// Test the specific branch where options.candidate?.scheduledAt is falsy
// This happens when we provide a candidate but no scheduledAt
const result = await enforceSchedulingFreezePolicy({
operation: "test-op",
freezePolicyPath: "path", // need to trigger the second part of the condition (options.cataloguePath || freezePath)
cataloguePath: undefined,
candidate: { sourceFile: "test" }, // missing schedule At
});

expect(result).toBe(true);
});
});
Loading