Skip to content
This repository has been archived by the owner on Jul 16, 2022. It is now read-only.

Commit

Permalink
chore: Fix prettier config and unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
Romain Lenzotti committed Aug 24, 2018
1 parent da42128 commit bbbb72b
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 19 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"travis-coveralls": "nyc report --reporter=text-lcov | coveralls",
"test": "npm run lint && nyc --reporter=html --reporter=text _mocha packages/**/*.spec.js --recursive",
"lint": "eslint \"{packages,test}/**/*.js\"",
"prettier": "prettier '{packages,test}/**/*.js' --write",
"prettier": "prettier \"{packages,test}/**/*.js\" --write",
"docs:dev": "vuepress dev docs",
"docs:build": "vuepress build docs",
"docs:deploy": "sh ./tasks/sh/deploy-doc.sh"
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ class CliService {
commander.usage(`${chalk.blue(name)} ${usage}`);
}

if (command.arguments) {
commander.arguments(command.arguments);
if (command.opts.arguments) {
commander.arguments(command.opts.arguments);
}

commander.option('--configPath <path>', 'Path to .nscrc file');
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/test/service.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ describe('Cli Service', () => {
});

it('should call plugin function', () => {
this.fnStub.should.have.been.calledWithExactly(commander, ['other']);
this.fnStub.should.have.been.calledWithExactly(commander, ['other'], []);
});

it('should call commander.option', () => commander.option.should.have.been.calledTwice);
Expand Down
33 changes: 18 additions & 15 deletions packages/config/test/config.spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const path = require('path');
const { expect, Sinon } = require('../../test/tools');
const Config = require('../src/config');
const formatPath = require('../src/utils/format-path');

const config = new Config();

Expand Down Expand Up @@ -160,59 +159,63 @@ describe('Config', () => {
});

it('should return authConfigFile', () => {
expect(config.authConfigFile).to.contains(formatPath('build/Website/App_config/Include/Unicorn/Unicorn.UI.config'));
expect(path.normalize(config.authConfigFile)).to.contains(
path.normalize('build/Website/App_config/Include/Unicorn/Unicorn.UI.config')
);
});

it('should return authConfigFile', () => {
expect(config.authConfigFilePath).to.contains(formatPath('build/Website/App_config/Include/Unicorn/Unicorn.UI.config'));
expect(path.normalize(config.authConfigFilePath)).to.contains(
path.normalize('build/Website/App_config/Include/Unicorn/Unicorn.UI.config')
);
});

it('should return rootDir', () => {
expect(config.rootDir).to.contains('');
expect(path.normalize(config.rootDir)).to.contains('');
});

it('should return instanceRoot', () => {
expect(config.instanceRoot).to.contains(formatPath('/build'));
expect(path.normalize(config.instanceRoot)).to.contains(path.normalize('/build'));
});

it('should return websiteRoot', () => {
expect(config.websiteRoot).to.contains(formatPath('build/Website'));
expect(path.normalize(config.websiteRoot)).to.contains(path.normalize('build/Website'));
});

it('should return themeWebsiteRoot', () => {
expect(config.themeWebsiteRoot).to.contains(formatPath('build/Website/themes'));
expect(path.normalize(config.themeWebsiteRoot)).to.contains(path.normalize('build/Website/themes'));
});

it('should return currentWebsiteRoot', () => {
expect(config.currentWebsiteRoot).to.contains(formatPath('build/Website/themes/Common'));
expect(path.normalize(config.currentWebsiteRoot)).to.contains(path.normalize('build/Website/themes/Common'));
});

it('should return sitecoreLibraries', () => {
expect(config.sitecoreLibrariesRoot).to.contains(formatPath('build/Website/bin'));
expect(path.normalize(config.sitecoreLibrariesRoot)).to.contains(path.normalize('build/Website/bin'));
});

it('should return licensePath', () => {
expect(config.licensePath).to.contains(formatPath('build/Data/license.xml'));
expect(path.normalize(config.licensePath)).to.contains(path.normalize('build/Data/license.xml'));
});

it('should return solutionPath', () => {
expect(config.solutionPath).to.contains(formatPath(path.join(process.cwd(), 'Base.sln')));
expect(path.normalize(config.solutionPath)).to.contains(path.normalize(path.join(process.cwd(), 'Base.sln')));
});

it('should return websiteViewsRoot', () => {
expect(config.websiteViewsRoot).to.contains(formatPath('build/Website/Views'));
expect(path.normalize(config.websiteViewsRoot)).to.contains(path.normalize('build/Website/Views'));
});

it('should return websiteConfigRoot', () => {
expect(config.websiteConfigRoot).to.equal(formatPath(path.join(process.cwd(), 'build/Website/App_Config')));
expect(path.normalize(config.websiteConfigRoot)).to.equal(path.normalize(path.join(process.cwd(), 'build/Website/App_Config')));
});

it('should return srcRoot', () => {
expect(config.srcRoot).to.equal(formatPath(path.join(process.cwd(), 'src')));
expect(path.normalize(config.srcRoot)).to.equal(path.normalize(path.join(process.cwd(), 'src')));
});

it('should return foundationRoot', () => {
expect(config.foundationRoot).to.equal(formatPath(path.join(process.cwd(), 'src/Foundation')));
expect(path.normalize(config.foundationRoot)).to.equal(path.normalize(path.join(process.cwd(), 'src/Foundation')));
});

it('should return foundationScriptsRoot', () => {
Expand Down

0 comments on commit bbbb72b

Please sign in to comment.