Skip to content

Commit

Permalink
update test
Browse files Browse the repository at this point in the history
  • Loading branch information
jer3k committed Nov 4, 2024
1 parent bf43336 commit a49c3d0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions backend/src/v1/services/analytic-service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import {
PowerBiResourceName,
} from './analytic-service';

const mockGetEmbedParamsForReports = jest.fn();
const mockgetEmbedParamsForReportsByName = jest.fn();
jest.mock('../../external/services/powerbi-service', () => {
const actual = jest.requireActual('../../external/services/powerbi-service');
return {
...actual,
PowerBiService: jest.fn().mockImplementation(() => {
return {
getEmbedParamsForReports: mockGetEmbedParamsForReports,
getEmbedParamsForReportsByName: mockgetEmbedParamsForReportsByName,
};
}),
};
Expand Down Expand Up @@ -40,7 +40,7 @@ describe('getEmbedInfo', () => {
expiry: '2024',
};

mockGetEmbedParamsForReports.mockResolvedValue({
mockgetEmbedParamsForReportsByName.mockResolvedValue({
resources: [
{ id: output.resources[0].id, embedUrl: output.resources[0].embedUrl },
{ id: output.resources[1].id, embedUrl: output.resources[1].embedUrl },
Expand All @@ -51,7 +51,7 @@ describe('getEmbedInfo', () => {
PowerBiResourceName.Analytics,
PowerBiResourceName.Analytics,
]);
expect(mockGetEmbedParamsForReports).toHaveBeenCalledTimes(1);
expect(mockgetEmbedParamsForReportsByName).toHaveBeenCalledTimes(1);
expect(json).toMatchObject(output);
});

Expand All @@ -62,6 +62,6 @@ describe('getEmbedInfo', () => {
'invalid' as never,
]),
).rejects.toThrow('Invalid resource names');
expect(mockGetEmbedParamsForReports).not.toHaveBeenCalled();
expect(mockgetEmbedParamsForReportsByName).not.toHaveBeenCalled();
});
});

0 comments on commit a49c3d0

Please sign in to comment.