Skip to content

Commit

Permalink
Avoid changing default options in tests (actions#102)
Browse files Browse the repository at this point in the history
Primarily because changing the default options shared amongst tests will
affect other tests.
  • Loading branch information
phillipj authored Jul 13, 2020
1 parent 3250717 commit c2daa6f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions __tests__/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function generateIssue(
};
}

const DefaultProcessorOptions: IssueProcessorOptions = {
const DefaultProcessorOptions: IssueProcessorOptions = Object.freeze({
repoToken: 'none',
staleIssueMessage: 'This issue is stale',
stalePrMessage: 'This PR is stale',
Expand All @@ -48,7 +48,7 @@ const DefaultProcessorOptions: IssueProcessorOptions = {
debugOnly: true,
removeStaleWhenUpdated: false,
ascending: false
};
});

test('empty issue list results in 1 operation', async () => {
const processor = new IssueProcessor(
Expand Down Expand Up @@ -517,7 +517,7 @@ test('stale label should be removed if a comment was added to a stale issue', as
)
];

const opts = DefaultProcessorOptions;
const opts = {...DefaultProcessorOptions};
opts.removeStaleWhenUpdated = true;

const processor = new IssueProcessor(
Expand Down Expand Up @@ -547,7 +547,7 @@ test('stale label should not be removed if a comment was added by the bot (and t
)
];

const opts = DefaultProcessorOptions;
const opts = {...DefaultProcessorOptions};
opts.removeStaleWhenUpdated = true;

const processor = new IssueProcessor(
Expand Down Expand Up @@ -577,7 +577,7 @@ test('stale issues should not be closed until after the closed number of days',
)
];

const opts = DefaultProcessorOptions;
const opts = {...DefaultProcessorOptions};
opts.daysBeforeStale = 5; // stale after 5 days
opts.daysBeforeClose = 1; // closes after 6 days

Expand Down Expand Up @@ -609,7 +609,7 @@ test('stale issues should be closed if the closed nubmer of days (additive) is a
)
];

const opts = DefaultProcessorOptions;
const opts = {...DefaultProcessorOptions};
opts.daysBeforeStale = 5; // stale after 5 days
opts.daysBeforeClose = 1; // closes after 6 days

Expand Down Expand Up @@ -640,7 +640,7 @@ test('stale issues should not be closed until after the closed number of days (l
)
];

const opts = DefaultProcessorOptions;
const opts = {...DefaultProcessorOptions};
opts.daysBeforeStale = 5; // stale after 5 days
opts.daysBeforeClose = 20; // closes after 25 days

Expand Down

0 comments on commit c2daa6f

Please sign in to comment.