Skip to content

Commit

Permalink
test: Use mock directly (#1146)
Browse files Browse the repository at this point in the history
#### Motivation

Simplify test
  • Loading branch information
l0b0 authored Nov 24, 2024
1 parent 9b81cd0 commit 326adaf
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,7 @@ await it('basemapsCreatePullRequest.handler should handle S3 target', async (t)
t.mock.method(GithubApi.prototype, 'createBlob', () => {});
t.mock.method(GithubApi.prototype, 'createCommit', () => {});
t.mock.method(GithubApi.prototype, 'updateBranch', () => {});
let createPullRequestCalled = false;
t.mock.method(GithubApi.prototype, 'createPullRequest', () => {
createPullRequestCalled = true;
});
const createPullRequestMock = t.mock.method(GithubApi.prototype, 'createPullRequest', () => {});
const targetUrlsString = JSON.stringify([targetUrl]);

const result = await basemapsCreatePullRequest.handler({
Expand All @@ -72,5 +69,5 @@ await it('basemapsCreatePullRequest.handler should handle S3 target', async (t)
ticket: 'any ticket',
});
assert.equal(result, undefined);
assert.ok(createPullRequestCalled);
assert.equal(createPullRequestMock.mock.callCount(), 1);
});

0 comments on commit 326adaf

Please sign in to comment.