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 3f7f326
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { anySlug } from '../../../utils/__test__/slugify.test.js';
import { GithubApi } from '../../../utils/github.js';
import { basemapsCreatePullRequest, ConfigType, LinzBasemapsSourceCollectionRel } from '../create-pr.js';
import { Category } from '../make.cog.github.js';
import assert from "node:assert";

Check failure on line 12 in src/commands/basemaps-github/__test__/create-pr-handler.test.ts

View workflow job for this annotation

GitHub Actions / build

Replace `"node:assert"` with `'node:assert'`

const originalEnv = Object.assign({}, process.env);

Expand Down Expand Up @@ -54,10 +55,11 @@ 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;});

Check failure on line 59 in src/commands/basemaps-github/__test__/create-pr-handler.test.ts

View workflow job for this annotation

GitHub Actions / build

Replace `createPullRequestCalled·=·true;` with `⏎····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 +69,6 @@ await it('basemapsCreatePullRequest.handler should handle S3 target', async (t)
vector: false,
ticket: 'any ticket',
});
assert.equal(result, undefined);
assert.ok(createPullRequestCalled)

Check failure on line 73 in src/commands/basemaps-github/__test__/create-pr-handler.test.ts

View workflow job for this annotation

GitHub Actions / build

Insert `;`
});

0 comments on commit 3f7f326

Please sign in to comment.