diff --git a/src/components/Canary/CanaryPopup/__tests__/CheckRunNow.unit.test.tsx b/src/components/Canary/CanaryPopup/__tests__/CheckRunNow.unit.test.tsx
index 695e3e6dd..624919435 100644
--- a/src/components/Canary/CanaryPopup/__tests__/CheckRunNow.unit.test.tsx
+++ b/src/components/Canary/CanaryPopup/__tests__/CheckRunNow.unit.test.tsx
@@ -37,6 +37,7 @@ describe("CheckRunNow", () => {
value={{
refresh: jest.fn(),
isAdmin: true,
+ isViewer: false,
hasResourceAccess: jest.fn(),
hasAnyResourceAccess: jest.fn(),
roles: ["admin"]
@@ -77,6 +78,7 @@ describe("CheckRunNow", () => {
value={{
refresh: jest.fn(),
isAdmin: true,
+ isViewer: false,
hasResourceAccess: jest.fn(),
hasAnyResourceAccess: jest.fn(),
roles: ["guest"]
diff --git a/src/components/Playbooks/Runs/Actions/__tests__/PlaybooksActionsResults.unit.test.tsx b/src/components/Playbooks/Runs/Actions/__tests__/PlaybooksActionsResults.unit.test.tsx
index d5057eb23..66b5df385 100644
--- a/src/components/Playbooks/Runs/Actions/__tests__/PlaybooksActionsResults.unit.test.tsx
+++ b/src/components/Playbooks/Runs/Actions/__tests__/PlaybooksActionsResults.unit.test.tsx
@@ -3,24 +3,55 @@ import PlaybooksRunActionsResults from "../PlaybooksActionsResults";
describe("PlaybooksRunActionsResults", () => {
it("renders 'No result' when result is falsy", () => {
- render();
+ render(
+
+ );
expect(screen.getByText("No result")).toBeInTheDocument();
});
it("renders stdout when result has stdout", () => {
- const action = { result: { stdout: "Hello, world!" } };
+ const action = {
+ id: "1",
+ name: "test",
+ status: "completed" as const,
+ playbook_run_id: "1",
+ start_time: "2024-01-01",
+ result: { stdout: "Hello, world!" }
+ };
render();
expect(screen.getByText("Hello, world!")).toBeInTheDocument();
});
it("renders logs when result has logs", () => {
- const action = { result: { logs: "Hello, world!" } };
+ const action = {
+ id: "1",
+ name: "test",
+ status: "completed" as const,
+ playbook_run_id: "1",
+ start_time: "2024-01-01",
+ result: { logs: "Hello, world!" }
+ };
render();
expect(screen.getByText("Hello, world!")).toBeInTheDocument();
});
it("renders JSON when result has neither stdout nor logs", () => {
- const action = { result: { foo: "bar" } };
+ const action = {
+ id: "1",
+ name: "test",
+ status: "completed" as const,
+ playbook_run_id: "1",
+ start_time: "2024-01-01",
+ result: { foo: "bar" }
+ };
render();
expect(
screen.getByText("foo", {
@@ -31,6 +62,11 @@ describe("PlaybooksRunActionsResults", () => {
it("shows stdout as the first tab", () => {
const action = {
+ id: "1",
+ name: "test",
+ status: "completed" as const,
+ playbook_run_id: "1",
+ start_time: "2024-01-01",
result: { stdout: "Hello, world!", stderr: "Goodbye, world!" }
};
render();
@@ -38,7 +74,14 @@ describe("PlaybooksRunActionsResults", () => {
});
it("renders error when action has error", () => {
- const action = { error: "Something went wrong" };
+ const action = {
+ id: "1",
+ name: "test",
+ status: "failed" as const,
+ playbook_run_id: "1",
+ start_time: "2024-01-01",
+ error: "Something went wrong"
+ };
render();
expect(
screen.getByText("Something went wrong", {
diff --git a/src/components/Playbooks/Runs/Submit/__tests__/SubmitPlaybookRunForm.unit.test.tsx b/src/components/Playbooks/Runs/Submit/__tests__/SubmitPlaybookRunForm.unit.test.tsx
index c68b7e923..b6120c8a3 100644
--- a/src/components/Playbooks/Runs/Submit/__tests__/SubmitPlaybookRunForm.unit.test.tsx
+++ b/src/components/Playbooks/Runs/Submit/__tests__/SubmitPlaybookRunForm.unit.test.tsx
@@ -27,6 +27,7 @@ const playbook: RunnablePlaybook & {
updated_at: "2021-09-01T00:00:00Z",
spec: {
icon: "playbook.svg",
+ actions: [],
components: [
{
types: ["kubernetes"]
diff --git a/src/components/Playbooks/Settings/__tests__/PlaybookSpecCard.unit.test.tsx b/src/components/Playbooks/Settings/__tests__/PlaybookSpecCard.unit.test.tsx
index 81b6ad3a2..2def5a395 100644
--- a/src/components/Playbooks/Settings/__tests__/PlaybookSpecCard.unit.test.tsx
+++ b/src/components/Playbooks/Settings/__tests__/PlaybookSpecCard.unit.test.tsx
@@ -16,6 +16,7 @@ const mockPlaybook: PlaybookSpec = {
spec: {
actions: [
{
+ name: "test-action",
exec: {
script: 'echo "{{.}}"'
}