1
0
Fork 0

feat(test): add example data-driven tests

This commit is contained in:
ssube 2020-08-11 19:15:16 -05:00
parent efb294e1cc
commit c5dc410dad
Signed by: ssube
GPG Key ID: 3EED7B957D362AF1
2 changed files with 43 additions and 0 deletions

18
test/TestResolve.ts Normal file
View File

@ -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);
});
}
});
});

25
test/resolve/cases.ts Normal file
View File

@ -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: [],
},
}];