Skip to content

Commit a23bda3

Browse files
authored
Update the readme, add a test (#46)
* Add a test to days = -1 * Update the readme on how to build it
1 parent 78921b6 commit a23bda3

2 files changed

Lines changed: 39 additions & 0 deletions

File tree

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,23 @@
22

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

5+
### Building and testing
6+
7+
Install the dependencies
8+
```bash
9+
$ npm install
10+
```
11+
12+
Build the typescript and package it for distribution
13+
```bash
14+
$ npm run build && npm run pack
15+
```
16+
17+
Run the tests :heavy_check_mark:
18+
```bash
19+
$ npm test
20+
```
21+
522
### Usage
623

724
See [action.yml](./action.yml) For comprehensive list of options.

__tests__/main.test.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,3 +178,25 @@ test('exempt pr labels will not be marked stale', async () => {
178178

179179
expect(processor.staleIssues.length).toEqual(2); // PR should get processed even though it has an exempt **issue** label
180180
});
181+
182+
test('stale issues should not be closed if days is set to -1', async () => {
183+
const TestIssueList: Issue[] = [
184+
generateIssue(1, 'My first issue', '2020-01-01T17:00:00Z', false, [
185+
'Stale'
186+
]),
187+
generateIssue(2, 'My first PR', '2020-01-01T17:00:00Z', true, ['Stale']),
188+
generateIssue(3, 'Another issue', '2020-01-01T17:00:00Z', false, ['Stale'])
189+
];
190+
191+
let opts = DefaultProcessorOptions;
192+
opts.daysBeforeClose = -1;
193+
194+
const processor = new IssueProcessor(DefaultProcessorOptions, async p =>
195+
p == 1 ? TestIssueList : []
196+
);
197+
198+
// process our fake issue list
199+
await processor.processIssues(1);
200+
201+
expect(processor.closedIssues.length).toEqual(0);
202+
});

0 commit comments

Comments
 (0)