Skip to content

Commit

Permalink
Update the readme, add a test (#46)
Browse files Browse the repository at this point in the history
* Add a test to days = -1
* Update the readme on how to build it
  • Loading branch information
hross authored Apr 16, 2020
1 parent 78921b6 commit a23bda3
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,23 @@

Warns and then closes issues and PRs that have had no activity for a specified amount of time.

### Building and testing

Install the dependencies
```bash
$ npm install
```

Build the typescript and package it for distribution
```bash
$ npm run build && npm run pack
```

Run the tests :heavy_check_mark:
```bash
$ npm test
```

### Usage

See [action.yml](./action.yml) For comprehensive list of options.
Expand Down
22 changes: 22 additions & 0 deletions __tests__/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,3 +178,25 @@ test('exempt pr labels will not be marked stale', async () => {

expect(processor.staleIssues.length).toEqual(2); // PR should get processed even though it has an exempt **issue** label
});

test('stale issues should not be closed if days is set to -1', async () => {
const TestIssueList: Issue[] = [
generateIssue(1, 'My first issue', '2020-01-01T17:00:00Z', false, [
'Stale'
]),
generateIssue(2, 'My first PR', '2020-01-01T17:00:00Z', true, ['Stale']),
generateIssue(3, 'Another issue', '2020-01-01T17:00:00Z', false, ['Stale'])
];

let opts = DefaultProcessorOptions;
opts.daysBeforeClose = -1;

const processor = new IssueProcessor(DefaultProcessorOptions, async p =>
p == 1 ? TestIssueList : []
);

// process our fake issue list
await processor.processIssues(1);

expect(processor.closedIssues.length).toEqual(0);
});

0 comments on commit a23bda3

Please sign in to comment.