2020-08-12 00:15:16 +00:00
|
|
|
import { expect } from 'chai';
|
|
|
|
|
2020-08-29 05:18:35 +00:00
|
|
|
import { resolveProject } from '../src/resolve';
|
2020-08-12 00:15:16 +00:00
|
|
|
import { TEST_CASES } from './resolve/cases';
|
|
|
|
|
2020-08-15 14:31:28 +00:00
|
|
|
const TEST_LABELS = ['foo', 'bar'];
|
|
|
|
|
2020-08-12 00:15:16 +00:00
|
|
|
describe('resolve labels', () => {
|
2020-08-15 14:31:28 +00:00
|
|
|
describe('with empty rule set', () => {
|
|
|
|
it('should return the existing labels', () => {
|
2020-08-29 05:18:35 +00:00
|
|
|
const result = resolveProject({
|
2020-08-15 14:31:28 +00:00
|
|
|
flags: [],
|
|
|
|
labels: TEST_LABELS,
|
|
|
|
states: [],
|
|
|
|
});
|
|
|
|
|
|
|
|
expect(result.labels).to.deep.equal(TEST_LABELS);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should not make any changes', () => {
|
2020-08-29 05:18:35 +00:00
|
|
|
const result = resolveProject({
|
2020-08-15 14:31:28 +00:00
|
|
|
flags: [],
|
|
|
|
labels: TEST_LABELS,
|
|
|
|
states: [],
|
|
|
|
});
|
|
|
|
|
|
|
|
expect(result.changes.length).to.equal(0);
|
|
|
|
});
|
|
|
|
});
|
2020-08-12 00:15:16 +00:00
|
|
|
|
|
|
|
// procedural tests
|
|
|
|
describe('resolver test cases', () => {
|
|
|
|
for (const test of TEST_CASES) {
|
|
|
|
it(`should resolve ${test.name}`, () => {
|
2020-08-29 05:18:35 +00:00
|
|
|
const actualResult = resolveProject(test.input);
|
2020-08-12 00:15:16 +00:00
|
|
|
expect(actualResult).to.deep.equal(test.result);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|