Add test for repoContentsUrl

Signed-off-by: Kevin L <kevin.lecouvey@gmail.com>
This commit is contained in:
Kevin L
2024-06-11 07:25:18 -04:00
parent d2f7400877
commit 2e1a8159ea
@@ -159,6 +159,7 @@ describe('publish:azure', () => {
it('should throw if there is no remoteUrl returned', async () => {
mockGitClient.createRepository.mockImplementation(() => ({
remoteUrl: null,
webUrl: 'http://google.com',
id: '709e891c-dee7-4f91-b963-534713c0737f',
}));
await expect(
@@ -174,6 +175,7 @@ describe('publish:azure', () => {
it('should throw if there is no repositoryId returned', async () => {
mockGitClient.createRepository.mockImplementation(() => ({
remoteUrl: 'http://google.com',
webUrl: 'http://google.com',
id: null,
}));
await expect(
@@ -186,6 +188,22 @@ describe('publish:azure', () => {
).rejects.toThrow(/No Id returned/);
});
it('should throw if there is no repoContentsUrl returned', async () => {
mockGitClient.createRepository.mockImplementation(() => ({
remoteUrl: 'http://google.com',
webUrl: null,
id: '709e891c-dee7-4f91-b963-534713c0737f',
}));
await expect(
action.handler({
...mockContext,
input: {
repoUrl: 'dev.azure.com?repo=bob&owner=owner&organization=org',
},
}),
).rejects.toThrow(/No web URL returned/);
});
it('should call the azureApis with the correct values', async () => {
mockGitClient.createRepository.mockImplementation(() => ({
remoteUrl: 'http://google.com',