@stryker-mutator/core
Version:
The extendable JavaScript mutation testing framework
41 lines • 1.63 kB
JavaScript
import { expect } from 'chai';
import { TravisProvider } from '../../../../src/reporters/ci/travis-provider.js';
import { EnvironmentVariableStore } from '../../../helpers/environment-variable-store.js';
describe(TravisProvider.name, () => {
const env = new EnvironmentVariableStore();
let sut;
beforeEach(() => {
sut = new TravisProvider();
env.unset('TRAVIS_REPO_SLUG');
env.unset('TRAVIS_PULL_REQUEST_BRANCH');
env.unset('TRAVIS_BRANCH');
});
afterEach(() => {
env.restore();
});
describe('determineVersion()', () => {
it('should return the current branch', () => {
env.set('TRAVIS_BRANCH', 'master');
env.unset('TRAVIS_PULL_REQUEST_BRANCH');
const result = sut.determineVersion();
expect(result).to.equal('master');
});
it('should return the PR branch if that is set', () => {
env.set('TRAVIS_BRANCH', 'master');
env.set('TRAVIS_PULL_REQUEST_BRANCH', 'feat/foo-bar');
const result = sut.determineVersion();
expect(result).to.equal('feat/foo-bar');
});
});
describe('determineProject()', () => {
it('should return the appropriate value', () => {
env.set('TRAVIS_REPO_SLUG', 'stryker/stryker');
const result = sut.determineProject();
expect(result).to.equal('github.com/stryker/stryker');
});
it('should return undefined if missing', () => {
expect(sut.determineProject()).undefined;
});
});
});
//# sourceMappingURL=travis-provider.spec.js.map