Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sorenlouv committed Jun 21, 2020
1 parent 4c10fd4 commit 5425925
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/options/cliArgs.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { getOptionsFromCliArgs } from './cliArgs';
import { OptionsFromConfigFiles } from './config/config';
import { getOptionsFromCliArgs, OptionsFromCliArgs } from './cliArgs';

describe('getOptionsFromCliArgs', () => {
it('should return correct options', () => {
const configOptions = {
const configOptions: Partial<OptionsFromCliArgs> = {
accessToken: 'myAccessToken',
all: false,
fork: true,
Expand Down Expand Up @@ -39,6 +38,7 @@ describe('getOptionsFromCliArgs', () => {
expect(res).toEqual({
accessToken: 'myAccessToken',
all: true,
assignees: [],
dryRun: false,
fork: true,
gitHostname: 'github.com',
Expand All @@ -62,7 +62,7 @@ describe('getOptionsFromCliArgs', () => {
});

it('should accept both camel-case and dashed-case and convert them to camel cased', () => {
const configOptions = {} as OptionsFromConfigFiles;
const configOptions: Partial<OptionsFromCliArgs> = {};
const argv = [
'--access-token',
'my access token',
Expand All @@ -79,7 +79,7 @@ describe('getOptionsFromCliArgs', () => {
});

it('should accept aliases (--pr) but only return the full name (--pullNumber) in the result', () => {
const configOptions = {} as OptionsFromConfigFiles;
const configOptions: Partial<OptionsFromCliArgs> = {};
const argv = ['--pr', '1337'];

const res = getOptionsFromCliArgs(configOptions, argv);
Expand Down
1 change: 1 addition & 0 deletions src/options/options.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ describe('getOptions', () => {
accessToken: 'myAccessToken',
all: false,
author: 'sqren',
assignees: [],
dryRun: false,
fork: true,
gitHostname: 'github.com',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ Array [
Object {
"accessToken": "myAccessToken",
"all": false,
"assignees": Array [],
"author": "sqren",
"branchLabelMapping": undefined,
"dryRun": false,
Expand Down
3 changes: 3 additions & 0 deletions src/ui/cherrypickAndCreatePullRequest.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ describe('cherrypickAndCreateTargetPullRequest', () => {
.mockResolvedValue({ stdout: '', stderr: '' });

const options = {
assignees: [] as string[],
githubApiBaseUrlV3: 'https://api.github.com',
fork: true,
targetPRLabels: ['backport'],
Expand Down Expand Up @@ -142,6 +143,7 @@ describe('cherrypickAndCreateTargetPullRequest', () => {
describe('when commit does not have a pull request reference', () => {
beforeEach(async () => {
const options = {
assignees: [] as string[],
githubApiBaseUrlV3: 'https://api.github.com',
fork: true,
targetPRLabels: ['backport'],
Expand Down Expand Up @@ -202,6 +204,7 @@ describe('cherrypickAndCreateTargetPullRequest', () => {
const execSpy = setupExecSpy();

const options = {
assignees: [] as string[],
fork: true,
targetPRLabels: ['backport'],
prTitle: '[{targetBranch}] {commitMessages}',
Expand Down

0 comments on commit 5425925

Please sign in to comment.