Skip to content

Commit

Permalink
test: update block-list testing
Browse files Browse the repository at this point in the history
  • Loading branch information
jamacku committed Apr 30, 2024
1 parent 5d343ea commit 718272b
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion test/action.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ describe('Integration test', () => {
setDefaultInputs();
vi.stubEnv('INPUT_ISSUE-FORM', JSON.stringify(dropdownForm));
vi.stubEnv('INPUT_SECTION', 'type');
vi.stubEnv('INPUT_BLOCK-LIST', 'other\nnone');
vi.stubEnv('INPUT_BLOCK-LIST', 'other\nnone\nOther');

vi.mocked(mocks['@octokit/core']).config.get.mockImplementation(
async (params: { owner: string; repo: string; path: string }) => {
Expand Down
2 changes: 2 additions & 0 deletions test/unit/config.fixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@ export const templateConfig = {
section: [
{
id: ['type'],
'block-list': ['Other'],
label: [
{ name: 'bug 🐛', keys: ['Bug Report'] },
{ name: 'RFE 🎁', keys: ['Feature Request'] },
],
},
{
id: ['severity'],
'block-list': ['None', 'Other'],
label: [
{ name: 'high', keys: ['High'] },
{ name: 'medium', keys: ['Medium'] },
Expand Down
9 changes: 7 additions & 2 deletions test/unit/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,9 @@ describe('Test Config class', () => {
{
"section": [
{
"block-list": [],
"block-list": [
"Other",
],
"id": [
"type",
],
Expand All @@ -157,7 +159,10 @@ describe('Test Config class', () => {
],
},
{
"block-list": [],
"block-list": [
"None",
"Other",
],
"id": [
"severity",
],
Expand Down
2 changes: 1 addition & 1 deletion test/unit/issue-form.fixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ export const dropdownForm = {
title: 'Test issue',
body: 'Test body',
severity: 'High',
type: 'Bug Report, Feature Request, other, none',
type: 'Bug Report, Feature Request, Other, none',
checkList: ['one', 'two', 'three'],
};
2 changes: 1 addition & 1 deletion test/unit/issue-form.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ describe('Test IssueForm class', () => {
]
`);

expect(issueForm.listKeywords('type', ['other', 'none']))
expect(issueForm.listKeywords('type', ['other', 'none', 'Other']))
.toMatchInlineSnapshot(`
[
"Bug Report",
Expand Down
3 changes: 2 additions & 1 deletion test/unit/labeler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ describe('Test Labeler class', () => {

beforeEach(() => {
vi.stubEnv('INPUT_SECTION', 'type');
vi.stubEnv('INPUT_BLOCK-LIST', 'other\nnone');
vi.stubEnv('INPUT_BLOCK-LIST', 'other\nnone\nOther');

labeler = new Labeler(
new IssueForm(dropdownForm),
Expand All @@ -43,6 +43,7 @@ describe('Test Labeler class', () => {
[
"other",
"none",
"Other",
]
`);

Expand Down

0 comments on commit 718272b

Please sign in to comment.