-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(test): add example data-driven tests
- Loading branch information
Showing
2 changed files
with
43 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { expect } from 'chai'; | ||
|
||
import { resolveLabels } from '../src/resolve'; | ||
import { TEST_CASES } from './resolve/cases'; | ||
|
||
describe('resolve labels', () => { | ||
it('should return the existing labels when no rules are provided'); | ||
|
||
// procedural tests | ||
describe('resolver test cases', () => { | ||
for (const test of TEST_CASES) { | ||
it(`should resolve ${test.name}`, () => { | ||
const actualResult = resolveLabels(test.input); | ||
expect(actualResult).to.deep.equal(test.result); | ||
}); | ||
} | ||
}); | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { ResolveInput, ResolveResult } from '../../src/resolve'; | ||
|
||
export interface ResolveTestCase { | ||
input: ResolveInput; | ||
name: string; | ||
result: ResolveResult; | ||
} | ||
|
||
export const TEST_CASES: Array<ResolveTestCase> = [{ | ||
input: { | ||
config: { | ||
colors: [], | ||
flags: [], | ||
states: [], | ||
}, | ||
issue: '', | ||
labels: [], | ||
}, | ||
name: 'test-1', | ||
result: { | ||
changes: [], | ||
errors: [], | ||
labels: [], | ||
}, | ||
}]; |