Add a test for when token is passed in

This commit is contained in:
Taras Mankovski
2020-10-08 08:02:21 -04:00
parent 4837a166c2
commit d69da85a27
@@ -90,7 +90,6 @@ describe('GitHubPreparer', () => {
{},
);
});
it('return the temp directory with the path to the folder if it is specified', async () => {
const preparer = new GithubPreparer();
mockEntity.spec.path = './template/test/1/2/3';
@@ -100,4 +99,20 @@ describe('GitHubPreparer', () => {
/\/template\/test\/1\/2\/3$/,
);
});
it('calls the clone command with the token when provided', async () => {
const preparer = new GithubPreparer({ token: 'abc' });
await preparer.prepare(mockEntity);
expect(mocks.Clone.clone).toHaveBeenNthCalledWith(
1,
'https://github.com/benjdlambert/backstage-graphql-template',
expect.any(String),
{
fetchOpts: {
callbacks: {
credentials: expect.any(Function),
},
},
},
);
});
});