mocked helper in github repo create tests
Signed-off-by: Phred <fearphage@gmail.com>
This commit is contained in:
+4
-1
@@ -28,6 +28,7 @@ import {
|
||||
import { when } from 'jest-when';
|
||||
import { PassThrough } from 'stream';
|
||||
import { createGithubRepoCreateAction } from './githubRepoCreate';
|
||||
import { familiarizeEntityName } from '../helpers';
|
||||
|
||||
const mockOctokit = {
|
||||
rest: {
|
||||
@@ -83,15 +84,17 @@ describe('github:repo:create', () => {
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
jest.resetAllMocks();
|
||||
githubCredentialsProvider =
|
||||
DefaultGithubCredentialsProvider.fromIntegrations(integrations);
|
||||
action = createGithubRepoCreateAction({
|
||||
integrations,
|
||||
githubCredentialsProvider,
|
||||
});
|
||||
(familiarizeEntityName as jest.Mock).mockImplementation((s: string) => s);
|
||||
});
|
||||
|
||||
afterEach(jest.resetAllMocks);
|
||||
|
||||
it('should call the githubApis with the correct values for createInOrg', async () => {
|
||||
mockOctokit.rest.users.getByUsername.mockResolvedValue({
|
||||
data: { type: 'Organization' },
|
||||
|
||||
@@ -90,7 +90,6 @@ describe('publish:github', () => {
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
jest.resetAllMocks();
|
||||
githubCredentialsProvider =
|
||||
DefaultGithubCredentialsProvider.fromIntegrations(integrations);
|
||||
action = createPublishGithubAction({
|
||||
@@ -105,6 +104,8 @@ describe('publish:github', () => {
|
||||
);
|
||||
});
|
||||
|
||||
afterEach(jest.resetAllMocks);
|
||||
|
||||
it('should fail to create if the team is not found in the org', async () => {
|
||||
mockOctokit.rest.users.getByUsername.mockResolvedValue({
|
||||
data: { type: 'Organization' },
|
||||
|
||||
Reference in New Issue
Block a user