Skip to content

Commit

Permalink
test: Add assertion that the PR creation method was called
Browse files Browse the repository at this point in the history
  • Loading branch information
l0b0 committed Nov 24, 2024
1 parent bbab965 commit 6e5c175
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/commands/basemaps-github/__test__/create-pr-handler.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import assert from 'node:assert';
import { afterEach, it } from 'node:test';

import { TileSetType } from '@basemaps/config/build/config/tile.set.js';
Expand Down Expand Up @@ -54,10 +55,13 @@ 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', () => {});
t.mock.method(GithubApi.prototype, 'createPullRequest', () => {});
let createPullRequestCalled = false;
t.mock.method(GithubApi.prototype, 'createPullRequest', () => {
createPullRequestCalled = true;
});
const targetUrlsString = JSON.stringify([targetUrl]);

await basemapsCreatePullRequest.handler({
const result = await basemapsCreatePullRequest.handler({
target: targetUrlsString,
repository: 'any-owner/any-repository',
verbose: false,
Expand All @@ -67,4 +71,6 @@ await it('basemapsCreatePullRequest.handler should handle S3 target', async (t)
vector: false,
ticket: 'any ticket',
});
assert.equal(result, undefined);
assert.ok(createPullRequestCalled);
});

0 comments on commit 6e5c175

Please sign in to comment.