feat(test): add example data-driven tests
This commit is contained in:
parent
efb294e1cc
commit
c5dc410dad
|
@ -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);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
|
@ -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: [],
|
||||
},
|
||||
}];
|
Loading…
Reference in New Issue