Skip to content

Commit

Permalink
feat(test): add example data-driven tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ssube committed Aug 12, 2020
1 parent efb294e commit c5dc410
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/TestResolve.ts
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);
});
}
});
});
25 changes: 25 additions & 0 deletions test/resolve/cases.ts
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: [],
},
}];

0 comments on commit c5dc410

Please sign in to comment.