result.should.equal('EXEC: slip sliding away'); }) .then(_shell.exec.restore()) .should.be.fulfilled; }); .should.be.fulfilled; }); child.spawn.restore(); }); sinon.stub(child, 'spawn').callsFake(fakeSpawn); return shell.sh(['set', 'us', 'up', 'the', 'bomb'], {mode: 'attach'}).should.be.rejected .then(child.spawn.restore()); }); sinon.stub(child, 'spawn').callsFake(fakeSpawn); return shell.sh(['van', 'the', 'man'], {detached: true}).should.be.fulfilled .then(child.spawn.restore()); }); }); return shell.sh(['van', 'the', 'man'], {mode: 'attach'}).should.be.fulfilled .then(child.spawn.restore()) .then(() => { delete process.lando; }); return shell.sh(['van', 'the', 'man'], {mode: 'attach'}).should.be.fulfilled
describe('init', function() { beforeEach(function() { fse.emptyDirSync(mockSitePath); process.chdir(mockSitePath); sinon.stub(cp, 'exec'); }); afterEach(function() { cp.exec.restore(); process.chdir('.'); }); it('should initialize site', function() { nanogen.init(); cp.exec.args[0][1](); expect(cp.exec.args[0][0]).to.equal('npm i -D nanogen --loglevel error'); expect(fse.existsSync('./site.config.js')).to.be.true; expect(fse.existsSync('./package.json')).to.be.true; expect(fse.existsSync('./src')).to.be.true; }); });