// This renders the restore page similar to backup page app.get(routes.restore, function(req, res) { // get all the crontabs restore.crontabs(req.query.db, function(docs){ res.render('restore', { routes : JSON.stringify(routes_relative), crontabs : JSON.stringify(docs), backups : crontab.get_backup_names(), db: req.query.db }); }); });
it('should return validation error if metric type is invalid', async () => { sinon.stub(Metric.prototype, 'insertDatapoints').returns([]) sinon.stub(MetricsStoreProxy.prototype, 'get').returns(new Metric({metricID: '1', type: 'Mock'})) sinon.stub(MockService.prototype, 'shouldAdminPostDatapoints').returns(false) const id = 123 await handle({[id]: []}, null, (error, result) => { error = JSON.parse(error) assert(error.length === 1) assert(error[0].message.match(/Mock/)) }) MockService.prototype.shouldAdminPostDatapoints.restore() })
test('loads internal towers', () => { mock({ '/path/to/node_modules/@warriorjs/cli': {} }); loadTowers(); mock.restore(); expect(Tower).toHaveBeenCalledWith( 'baby-steps', 'Baby Steps', 'For players new to WarriorJS', ['level1', 'level2'], ); });
app.makeSingleInstance((commandLine, workingDirectory) => { if (mainWindow) { if (mainWindow.isMinimized()) mainWindow.restore() mainWindow.focus() } })
restore() { if (this.state.closed || this.options.show === false) return; let { prompt, after, rest } = this.sections(); let { cursor, initial = '', input = '', value = '' } = this; let size = this.state.size = rest.length; let state = { after, cursor, initial, input, prompt, size, value }; let codes = ansi.cursor.restore(state); if (codes) { this.stdout.write(codes); } }
describe('#__get', () => { it('should be the same as new NodeCache().get', () => { filesystem(); const cache = new Cache(); cache.set('yyz', 'amazing'); const nCache = new NodeCache(); nCache.set('yyz', 'amazing'); cache.__get('yyz').should.eql(nCache.get('yyz')); filesystem.restore(); }); });
onDisconnect() { nock.cleanAll(); nock.restore(); this.NativeClientRequest = null; }
describe('create', () => { afterEach(() => { AWS.restore('DynamoDB.DocumentClient') }) it('should generate component id', async () => { const store = new ComponentsStore() store.update = sinon.spy() await store.create(new Component({})) assert(store.update.calledOnce) assert(store.update.firstCall.args[0].componentID.length === 12) }) })
afterEach(() => { CloudFormation.prototype.getSubscribersPoolID.restore() CloudFormation.prototype.getStatusPageCloudFrontURL.restore() SettingsProxy.prototype.getEmailNotification.restore() SettingsProxy.prototype.getServiceName.restore() SES.prototype.sendEmailWithRetry.restore() IncidentsStore.prototype.get.restore() IncidentUpdatesStore.prototype.query.restore() Cognito.prototype.listUsers.restore() console.log.restore() })
afterEach((done) => { agent.destroy(); sandbox.restore(); server.close(done); });
test('makes directory', () => { mock({ '/path/to': {} }); profile.makeProfileDirectory(); expect(fs.statSync('/path/to/profile').isDirectory()).toBe(true); mock.restore(); });
describe('#__set', () => { it('should be the same as new NodeCache().set', () => { filesystem(); const cache = new Cache(); const nCache = new NodeCache(); cache.__set('yyz', 'amazing').should.eql(nCache.set('yyz', 'amazing')); filesystem.restore(); }); });