Files
privacy.sexy/tests/unit/application/Parser/ProjectInformationParser.spec.ts
undergroundwires 60c80611ea add module alias '@tests/'
Alias would remove unnecessary repetitions and less relative paths make changes easier when moving around files. This commit cleans also up some relative paths ('../../../') by using the alias and orders imports. It updates both path alias in tsconfig and module alias in Vue CLI's bundler (vuejs/vue-cli#2398).
2021-04-15 18:34:40 +02:00

50 lines
1.9 KiB
TypeScript

import 'mocha';
import { expect } from 'chai';
import { parseProjectInformation } from '@/application/Parser/ProjectInformationParser';
import { getProcessEnvironmentStub } from '@tests/unit/stubs/ProcessEnvironmentStub';
describe('ProjectInformationParser', () => {
describe('parseProjectInformation', () => {
it('parses expected repository version', () => {
// arrange
const expected = 'expected-version';
const env = getProcessEnvironmentStub();
env.VUE_APP_VERSION = expected;
// act
const info = parseProjectInformation(env);
// assert
expect(info.version).to.be.equal(expected);
});
it('parses expected repository url', () => {
// arrange
const expected = 'https://expected-repository.url';
const env = getProcessEnvironmentStub();
env.VUE_APP_REPOSITORY_URL = expected;
// act
const info = parseProjectInformation(env);
// assert
expect(info.repositoryUrl).to.be.equal(expected);
});
it('parses expected name', () => {
// arrange
const expected = 'expected-app-name';
const env = getProcessEnvironmentStub();
env.VUE_APP_NAME = expected;
// act
const info = parseProjectInformation(env);
// assert
expect(info.name).to.be.equal(expected);
});
it('parses expected homepage url', () => {
// arrange
const expected = 'https://expected.sexy';
const env = getProcessEnvironmentStub();
env.VUE_APP_HOMEPAGE_URL = expected;
// act
const info = parseProjectInformation(env);
// assert
expect(info.homepage).to.be.equal(expected);
});
});
});