forked from int128/hide-comment-action
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add ends-with option * Fix optional inputs * Fix e2e test * Add test and fix bug
- Loading branch information
Showing
6 changed files
with
211 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,155 @@ | ||
test('run successfully', async () => { | ||
//TODO | ||
import { toMinimize } from '../src/run' | ||
|
||
describe('filter to minimize', () => { | ||
test('no filter', () => { | ||
expect( | ||
toMinimize( | ||
{ | ||
id: `id`, | ||
body: `body`, | ||
isMinimized: false, | ||
url: `https://www.example.com`, | ||
}, | ||
{ | ||
authors: [], | ||
endsWith: [], | ||
startsWith: [], | ||
token: `token`, | ||
} | ||
) | ||
).toBeFalsy() | ||
}) | ||
|
||
test('already minimized', () => { | ||
expect( | ||
toMinimize( | ||
{ | ||
id: `id`, | ||
body: `body`, | ||
isMinimized: true, | ||
url: `https://www.example.com`, | ||
author: { login: 'github-actions', url: '', avatarUrl: '', resourcePath: '' }, | ||
}, | ||
{ | ||
authors: ['github-actions'], | ||
endsWith: [], | ||
startsWith: [], | ||
token: `token`, | ||
} | ||
) | ||
).toBeFalsy() | ||
}) | ||
|
||
test('authors filter', () => { | ||
expect( | ||
toMinimize( | ||
{ | ||
id: `id`, | ||
body: `body`, | ||
isMinimized: false, | ||
url: `https://www.example.com`, | ||
author: { login: 'github-actions', url: '', avatarUrl: '', resourcePath: '' }, | ||
}, | ||
{ | ||
authors: ['github-actions'], | ||
endsWith: [], | ||
startsWith: [], | ||
token: `token`, | ||
} | ||
) | ||
).toBeTruthy() | ||
}) | ||
test('authors filter did not match', () => { | ||
expect( | ||
toMinimize( | ||
{ | ||
id: `id`, | ||
body: `body`, | ||
isMinimized: false, | ||
url: `https://www.example.com`, | ||
author: { login: 'github-actions', url: '', avatarUrl: '', resourcePath: '' }, | ||
}, | ||
{ | ||
authors: ['bot'], | ||
endsWith: [], | ||
startsWith: [], | ||
token: `token`, | ||
} | ||
) | ||
).toBeFalsy() | ||
}) | ||
|
||
test('starts-with filter', () => { | ||
expect( | ||
toMinimize( | ||
{ | ||
id: `id`, | ||
body: `<!-- head -->body`, | ||
isMinimized: false, | ||
url: `https://www.example.com`, | ||
}, | ||
{ | ||
authors: [], | ||
endsWith: [], | ||
startsWith: ['<!-- head -->'], | ||
token: `token`, | ||
} | ||
) | ||
).toBeTruthy() | ||
}) | ||
test('starts-with filter did not match', () => { | ||
expect( | ||
toMinimize( | ||
{ | ||
id: `id`, | ||
body: `body`, | ||
isMinimized: false, | ||
url: `https://www.example.com`, | ||
}, | ||
{ | ||
authors: [], | ||
endsWith: [], | ||
startsWith: ['<!-- head -->'], | ||
token: `token`, | ||
} | ||
) | ||
).toBeFalsy() | ||
}) | ||
|
||
test('ends-with filter', () => { | ||
expect( | ||
toMinimize( | ||
{ | ||
id: `id`, | ||
body: `body<!-- tail -->`, | ||
isMinimized: false, | ||
url: `https://www.example.com`, | ||
}, | ||
{ | ||
authors: [], | ||
endsWith: ['<!-- tail -->'], | ||
startsWith: [], | ||
token: `token`, | ||
} | ||
) | ||
).toBeTruthy() | ||
}) | ||
test('ends-with filter did not match', () => { | ||
expect( | ||
toMinimize( | ||
{ | ||
id: `id`, | ||
body: `body`, | ||
isMinimized: false, | ||
url: `https://www.example.com`, | ||
}, | ||
{ | ||
authors: [], | ||
endsWith: ['<!-- tail -->'], | ||
startsWith: [], | ||
token: `token`, | ||
} | ||
) | ||
).toBeFalsy() | ||
}) | ||
}) |