Skip to content
This repository was archived by the owner on Dec 18, 2024. It is now read-only.

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
chubert-sb committed Nov 18, 2023
1 parent f72878c commit 6d326c0
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 19 deletions.
36 changes: 19 additions & 17 deletions src/components/testCaseLanding/qdm/CreateCodeCoverageNavTabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,23 +157,25 @@ export default function CreateCodeCoverageNavTabs(props: NavTabProps) {
/>
</Tabs>
<div style={{ margin: "6px 0 0 auto", display: "flex" }}>
<div>
<Button
onClick={() => {
if (onImportTestCases) {
onImportTestCases();
}
}}
disabled={!canEdit}
data-testid="show-import-test-cases-button"
>
<FileUploadIcon
style={{ margin: "0 5px 0 -2px" }}
fontSize="small"
/>
Import Test Cases
</Button>
</div>
{featureFlags?.importTestCases && (
<div>
<Button
onClick={() => {
if (onImportTestCases) {
onImportTestCases();
}
}}
disabled={!canEdit}
data-testid="show-import-test-cases-button"
>
<FileUploadIcon
style={{ margin: "0 5px 0 -2px" }}
fontSize="small"
/>
Import Test Cases
</Button>
</div>
)}
<div style={{ margin: "0 6px 0 26px" }}>
<Button
disabled={!canEdit}
Expand Down
7 changes: 5 additions & 2 deletions src/components/testCaseLanding/qdm/TestCaseList.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,7 @@ const useTestCaseServiceMockResolved = {
.fn()
.mockResolvedValue(["Series 1", "Series 2"]),
createTestCases: jest.fn().mockResolvedValue([]),
importTestCasesQDM: jest.fn().mockResolvedValue([]),
} as unknown as TestCaseServiceApi;

// mocking measureService
Expand Down Expand Up @@ -1111,7 +1112,7 @@ describe("TestCaseList component", () => {
expect(nextState).toEqual([]);
});

it("should display import error when createTestCases call fails", async () => {
it("should display import error when importTestCasesQDM call fails", async () => {
(checkUserCanEdit as jest.Mock).mockClear().mockImplementation(() => true);
(useFeatureFlags as jest.Mock).mockClear().mockImplementation(() => ({
importTestCases: true,
Expand All @@ -1122,7 +1123,9 @@ describe("TestCaseList component", () => {
getTestCaseSeriesForMeasure: jest
.fn()
.mockResolvedValue(["Series 1", "Series 2"]),
createTestCases: jest.fn().mockRejectedValueOnce(new Error("BAD THINGS")),
importTestCasesQDM: jest
.fn()
.mockRejectedValueOnce(new Error("BAD THINGS")),
} as unknown as TestCaseServiceApi;

useTestCaseServiceMock.mockImplementation(() => {
Expand Down

0 comments on commit 6d326c0

Please sign in to comment.