describe('getForm tests', () => { const data = { human: 'good', cylon: 'bad' }; it('returns a FormData instance', () => { thingiverse.getForm().should.be.an.instanceof(FormData) .and.have.property('_valueLength', 0); }); it('adds given fields', () => { thingiverse.getForm(data).getLengthSync().should.be.gt(0); }); });
describe('Test GithubService', () => { describe('getClosedIssues()', () => { it('should return closed issues', async () => { const [owner, repo] = ['imheretw', 'imhere']; httpMocks.githubHttpMock .get(GITHUB_API_ENDPOINTS.closedIssues(owner, repo)) .reply(200, githubClosedIssueData); const issues = await GithubService.getClosedIssues(); const issue = issues[0]; expect(issues.length).be.gt(1); expect(issue.title).be.eq('Kue screenshot'); }); }); });
describe('createDeferred', () => { it('should create a deferred promise object', () => { const deferred = utils.createDeferred(); expect(deferred.promise).to.be.defined; deferred.resolve(); return deferred.promise; }); it('should resolve after the specified timeout', () => { const delay = 1000; const startTime = Date.now(); const deferred = utils.createDeferred(delay); return deferred.promise.catch(err => { const elapsedTime = Date.now() - startTime; // delays are approximative with JS ticks expect(elapsedTime).to.be.gt(delay - 10); expect(elapsedTime).to.be.lt(delay + 10); expect(err.message).to.be.eql('1000ms timeout reached'); }); }); });
expect(profileUpdateUser.lastUpdated).to.be.gt(createdUser.lastUpdated);
describe('Test github controller', () => { describe('GET /github-demo/api/closed_issues', () => { it('should return closed issues', async () => { const [owner, repo] = ['imheretw', 'imhere']; httpMocks.githubHttpMock .get(GITHUB_API_ENDPOINTS.closedIssues(owner, repo)) .reply(200, githubClosedIssueData); const res = await chai.request(server.expressServer) .get('/github-demo/api/closed_issues'); const issues = res.body.issues; expect(res.status).to.equal(200); expect(res).to.be.json; expect(issues).to.a('array'); expect(issues.length).to.gt(1); expect(issues[0]).to.have.property('title', 'Kue screenshot'); }); }); });
expect(counter.get(e1) / SIZE).to.be.gt(0.4) expect(counter.get(e1) / SIZE).to.be.lt(0.6) expect(counter.get(e2) / SIZE).to.be.gt(0.4) expect(counter.get(e2) / SIZE).to.be.lt(0.6) }) expect(counter.get(e1) / SIZE).to.be.gt(0.1) expect(counter.get(e1) / SIZE).to.be.lt(0.3) expect(counter.get(e2) / SIZE).to.be.gt(0.7) expect(counter.get(e2) / SIZE).to.be.lt(0.9) })
}) .then(data => { expect(data.length).gt(0); expect(data[0].REAL_ACTIVATION_DATE).eq('2016-06-01'); expect(data[0]).all.keys('PHONE_NUMBER', 'REAL_ACTIVATION_DATE');
expect(s).gt(2) })
expect(updatedUser.passwordChanged).to.be.gt(createdUser.passwordChanged);
expect(updatedUser.passwordChanged).to.be.gt(createdUser.passwordChanged);