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('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);
});
it('fills the authentication file with correct information', (done) => {
const regex = new RegExp(`'${prompts.strategyName}', '${prompts.pluginName}', {}`);
assert.fileContent(expected, regex);
done();
});
});