Skip to content

Commit

Permalink
Add mocks for uncommittedHash
Browse files Browse the repository at this point in the history
  • Loading branch information
ghengeveld committed Aug 15, 2023
1 parent d602ba6 commit 1426473
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions node-src/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ jest.mock('./git/git', () => ({
getVersion: () => Promise.resolve('2.24.1'),
getChangedFiles: () => Promise.resolve(['src/foo.stories.js']),
getRepositoryRoot: () => Promise.resolve(process.cwd()),
getUncommittedHash: () => Promise.resolve('abc123'),
}));

jest.mock('./git/getParentCommits', () => ({
Expand Down
4 changes: 4 additions & 0 deletions node-src/tasks/gitInfo.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ const getChangedFilesWithReplacement = <
>getChangedFilesWithReplacementUnmocked;
const getSlug = <jest.MockedFunction<typeof git.getSlug>>git.getSlug;
const getVersion = <jest.MockedFunction<typeof git.getVersion>>git.getVersion;
const getUncommittedHash = <jest.MockedFunction<typeof git.getUncommittedHash>>(
git.getUncommittedHash
);

const getBaselineBuilds = <jest.MockedFunction<typeof getBaselineBuildsUnmocked>>(
getBaselineBuildsUnmocked
Expand All @@ -42,6 +45,7 @@ const client = { runQuery: jest.fn(), setAuthorization: jest.fn() };

beforeEach(() => {
getCommitAndBranch.mockResolvedValue(commitInfo);
getUncommittedHash.mockResolvedValue('abc123');
getParentCommits.mockResolvedValue(['asd2344']);
getBaselineBuilds.mockResolvedValue([]);
getChangedFilesWithReplacement.mockResolvedValue({ changedFiles: [] });
Expand Down

0 comments on commit 1426473

Please sign in to comment.