Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('works', function () {
// write a temp file
let tempFilePath = path.join(__dirname, './testDir/tempDir/myTest.json');
let content = {foo: 'bar'};
let replacedContent = {foo: 'fuz'};
assert.noFile(tempFilePath);
fse.writeJsonSync(tempFilePath, content);
assert.file(tempFilePath);
assert.fileContent(tempFilePath, 'bar');
dbh.replaceContent(tempFilePath, 'bar', 'fuz', null);
assert.fileContent(tempFilePath, 'fuz');
fs.unlinkSync(tempFilePath);
assert.noFile(tempFilePath);
});
});
it('sets appropriate validate function', function () {
const myprompt = state.generator.processedPrompts[1];
assert.ok(myprompt.hasOwnProperty('validate'));
const validate = myprompt.validate;
let v = validate('');
// In IntelliJ, we get the ASCII back, in a terminal we don't. Just stripping it!
assert.equal(stripAnsi(v), 'The required myprompt value is missing or invalid');
v = validate('a value');
assert.equal(v, true);
});
it('adds _get-media.scss and import state to sass file', function () {
assert.file(srcPath + 'core/styles/_get-media.scss');
assert.fileContent(srcPath + 'app.scss', /@import \"core\/styles\/get-media\"/);
});
it('creates helper files', function () {
assert.file(helperPath + "_grunt/csscomb.js");
assert.file(helperPath + "task-configs/csscomb.json");
});
it('creates helper files', function () {
assert.file(helperPath + '_grunt/webfont.js');
assert.file(helperPath + '_grunt/custom/iconbuilder.js');
});
it('creates helper files', function () {
assert.file(helperPath + '_gulp/hinting.js');
assert.file(helperPath + 'task-configs/stylelint.config.js');
});
it('creates helper files', function () {
assert.file(helperPath + "_grunt/grunticon.js");
assert.file(helperPath + "_grunt/replace.js");
});
it('should have authors name in package.json and LICENSE', () => {
const packageJson = JSON.parse(fs.readFileSync('package.json'));
const regex = new RegExp(escapeStringRegexp(prompts.authorName), '');
packageJson.should.have
.propertyByPath('author', 'name')
.eql(prompts.authorName);
assert.fileContent('LICENSE', regex);
});
it('should render project name and description in README.md', () => {
let regex = new RegExp(escapeStringRegexp(prompts.projectDescription), '');
assert.fileContent('README.md', regex);
regex = new RegExp(
escapeStringRegexp(_s.titleize(prompts.projectName)),
''
);
assert.fileContent('README.md', regex);
});
it('should render project name and description in README.md', () => {
let regex = new RegExp(escapeStringRegexp(prompts.projectDescription), '');
assert.fileContent('README.md', regex);
regex = new RegExp(
escapeStringRegexp(_s.titleize(prompts.projectName)),
''
);
assert.fileContent('README.md', regex);
});