Remove try-catch blocks from tests
Signed-off-by: Kevin Snyder <kevin.snyder@gusto.com>
This commit is contained in:
@@ -140,11 +140,13 @@ describe('publish:github', () => {
|
||||
afterEach(jest.resetAllMocks);
|
||||
|
||||
it('should pass context logger to Octokit client', async () => {
|
||||
try {
|
||||
await action.handler(mockContext);
|
||||
} catch (e) {
|
||||
// no-op
|
||||
}
|
||||
mockOctokit.rest.users.getByUsername.mockResolvedValue({
|
||||
data: { type: 'Organization' },
|
||||
});
|
||||
|
||||
mockOctokit.rest.repos.createInOrg.mockResolvedValue({ data: {} });
|
||||
|
||||
await action.handler(mockContext);
|
||||
|
||||
expect(octokitMock).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ log: mockContext.logger }),
|
||||
|
||||
@@ -72,11 +72,7 @@ describe('github:actions:dispatch', () => {
|
||||
});
|
||||
|
||||
it('should pass context logger to Octokit client', async () => {
|
||||
try {
|
||||
await action.handler(mockContext);
|
||||
} catch (e) {
|
||||
// no-op
|
||||
}
|
||||
await action.handler(mockContext);
|
||||
|
||||
expect(octokitMock).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ log: mockContext.logger }),
|
||||
|
||||
@@ -71,11 +71,7 @@ describe('github:autolinks:create', () => {
|
||||
workspacePath,
|
||||
});
|
||||
|
||||
try {
|
||||
await action.handler(mockContext);
|
||||
} catch (e) {
|
||||
// no-op
|
||||
}
|
||||
await action.handler(mockContext);
|
||||
|
||||
expect(octokitMock).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ log: mockContext.logger }),
|
||||
|
||||
@@ -73,11 +73,7 @@ describe('github:branch-protection:create', () => {
|
||||
afterEach(jest.resetAllMocks);
|
||||
|
||||
it('should pass context logger to Octokit client', async () => {
|
||||
try {
|
||||
await action.handler(mockContext);
|
||||
} catch (e) {
|
||||
// no-op
|
||||
}
|
||||
await action.handler(mockContext);
|
||||
|
||||
expect(octokitMock).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ log: mockContext.logger }),
|
||||
|
||||
@@ -73,11 +73,14 @@ describe('github:deployKey:create', () => {
|
||||
});
|
||||
|
||||
it('should pass context logger to Octokit client', async () => {
|
||||
try {
|
||||
await action.handler(mockContext);
|
||||
} catch (e) {
|
||||
// no-op
|
||||
}
|
||||
mockOctokit.rest.actions.getRepoPublicKey.mockResolvedValue({
|
||||
data: {
|
||||
key: publicKey,
|
||||
key_id: 'keyid',
|
||||
},
|
||||
});
|
||||
|
||||
await action.handler(mockContext);
|
||||
|
||||
expect(octokitMock).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ log: mockContext.logger }),
|
||||
|
||||
@@ -141,11 +141,7 @@ describe('github:environment:create', () => {
|
||||
afterEach(jest.resetAllMocks);
|
||||
|
||||
it('should pass context logger to Octokit client', async () => {
|
||||
try {
|
||||
await action.handler(mockContext);
|
||||
} catch (e) {
|
||||
// no-op
|
||||
}
|
||||
await action.handler(mockContext);
|
||||
|
||||
expect(octokitMock).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ log: mockContext.logger }),
|
||||
|
||||
@@ -80,11 +80,7 @@ describe('github:issues:label', () => {
|
||||
});
|
||||
|
||||
it('should pass context logger to Octokit client', async () => {
|
||||
try {
|
||||
await action.handler(mockContext);
|
||||
} catch (e) {
|
||||
// no-op
|
||||
}
|
||||
await action.handler(mockContext);
|
||||
|
||||
expect(octokitMock).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ log: mockContext.logger }),
|
||||
|
||||
@@ -73,11 +73,7 @@ describe('github:pages', () => {
|
||||
afterEach(jest.resetAllMocks);
|
||||
|
||||
it('should pass context logger to Octokit client', async () => {
|
||||
try {
|
||||
await action.handler(mockContext);
|
||||
} catch (e) {
|
||||
// no-op
|
||||
}
|
||||
await action.handler(mockContext);
|
||||
|
||||
expect(octokitMock).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ log: mockContext.logger }),
|
||||
|
||||
@@ -111,11 +111,13 @@ describe('github:repo:create', () => {
|
||||
afterEach(jest.resetAllMocks);
|
||||
|
||||
it('should pass context logger to Octokit client', async () => {
|
||||
try {
|
||||
await action.handler(mockContext);
|
||||
} catch (e) {
|
||||
// no-op
|
||||
}
|
||||
mockOctokit.rest.users.getByUsername.mockResolvedValue({
|
||||
data: { type: 'Organization' },
|
||||
});
|
||||
|
||||
mockOctokit.rest.repos.createInOrg.mockResolvedValue({ data: {} });
|
||||
|
||||
await action.handler(mockContext);
|
||||
|
||||
expect(octokitMock).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ log: mockContext.logger }),
|
||||
|
||||
@@ -106,11 +106,14 @@ describe('github:repo:push', () => {
|
||||
});
|
||||
|
||||
it('should pass context logger to Octokit client', async () => {
|
||||
try {
|
||||
await action.handler(mockContext);
|
||||
} catch (e) {
|
||||
// no-op
|
||||
}
|
||||
mockOctokit.rest.repos.get.mockResolvedValue({
|
||||
data: {
|
||||
clone_url: 'https://github.com/clone/url.git',
|
||||
html_url: 'https://github.com/html/url',
|
||||
},
|
||||
});
|
||||
|
||||
await action.handler(mockContext);
|
||||
|
||||
expect(octokitMock).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ log: mockContext.logger }),
|
||||
|
||||
@@ -73,11 +73,7 @@ describe('github:repository:webhook:create', () => {
|
||||
});
|
||||
|
||||
it('should pass context logger to Octokit client', async () => {
|
||||
try {
|
||||
await action.handler(mockContext);
|
||||
} catch (e) {
|
||||
// no-op
|
||||
}
|
||||
await action.handler(mockContext);
|
||||
|
||||
expect(octokitMock).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ log: mockContext.logger }),
|
||||
|
||||
Reference in New Issue
Block a user