Skip to content

Commit

Permalink
Merge branch 'master' into clean-up-jscs-in-tests-api-v1-tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
annyhe committed Dec 29, 2016
2 parents 7cd2677 + 294ace7 commit 8eedd07
Show file tree
Hide file tree
Showing 8 changed files with 82 additions and 83 deletions.
10 changes: 5 additions & 5 deletions tests/api/v1/perspectives/delete.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe(`api: DELETE ${path}`, () => {
token = returnedToken;
done();
})
.catch((err) => done(err));
.catch(done);
});

before((done) => {
Expand All @@ -43,23 +43,23 @@ describe(`api: DELETE ${path}`, () => {
perspectiveId = createdPersp.id;
done();
})
.catch((err) => done(err));
.catch(done);
});

after(u.forceDelete);
after(tu.forceDeleteUser);

it('delete ok', (done) => {
api.delete(`${path}/${perspectiveId}`)
.set('Authorization', token)
.expect(constants.httpStatus.OK)
.end((err, res) => {
if (err) {
return done(err);
done(err);
}

expect(res.body.isDeleted).to.not.equal(0);
return done();
done();
});
});
});
24 changes: 12 additions & 12 deletions tests/api/v1/perspectives/get.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ describe(`api: GET ${path}`, () => {
token = returnedToken;
done();
})
.catch((err) => done(err));
.catch(done);
});

before((done) => {
Expand All @@ -51,7 +51,7 @@ describe(`api: GET ${path}`, () => {
perspectiveName = createdPersp.name;
done();
})
.catch((err) => done(err));
.catch(done);
});

after(u.forceDelete);
Expand All @@ -63,7 +63,7 @@ describe(`api: GET ${path}`, () => {
.expect(constants.httpStatus.OK)
.end((err, res) => {
if (err) {
return done(err);
done(err);
}

expect(res.body).to.have.length(1);
Expand All @@ -77,7 +77,7 @@ describe(`api: GET ${path}`, () => {
expect(res.body[0].subjectTagFilter).to.eql(['ea', 'na']);
expect(res.body[0].statusFilter).to.eql(['Critical', '-OK']);

return done();
done();
});
});

Expand All @@ -87,7 +87,7 @@ describe(`api: GET ${path}`, () => {
.expect(constants.httpStatus.OK)
.end((err, res) => {
if (err) {
return done(err);
done(err);
}

expect(res.body.name).to.equal(`${tu.namePrefix}testPersp`);
Expand All @@ -98,7 +98,7 @@ describe(`api: GET ${path}`, () => {
expect(res.body.subjectTagFilter).to.eql(['ea', 'na']);
expect(res.body.statusFilter).to.eql(['Critical', '-OK']);

return done();
done();
});
});

Expand All @@ -108,7 +108,7 @@ describe(`api: GET ${path}`, () => {
.expect(constants.httpStatus.OK)
.end((err, res) => {
if (err) {
return done(err);
done(err);
}

expect(res.body.name).to.equal(`${tu.namePrefix}testPersp`);
Expand All @@ -119,7 +119,7 @@ describe(`api: GET ${path}`, () => {
expect(res.body.aspectTagFilter).to.eql(['temp', 'hum']);
expect(res.body.subjectTagFilter).to.eql(['ea', 'na']);
expect(res.body.statusFilter).to.eql(['Critical', '-OK']);
return done();
done();
});
});

Expand All @@ -129,13 +129,13 @@ describe(`api: GET ${path}`, () => {
.expect(constants.httpStatus.OK)
.end((err, res) => {
if (err) {
return done(err);
done(err);
}

expect(res.body.name).to.equal(`${tu.namePrefix}testPersp`);
expect(res.body).to.not.have.property('rootSubject');
expect(res.body).to.not.have.property('lens');
return done();
done();
});
});

Expand All @@ -145,14 +145,14 @@ describe(`api: GET ${path}`, () => {
.expect(constants.httpStatus.OK)
.end((err, res) => {
if (err) {
return done(err);
done(err);
}

expect(res.body).to.have.length.of.at.least(1);
expect(res.body[0]).to.have.property('name');
expect(res.body[0]).to.have.property('rootSubject');
expect(res.body[0]).to.not.have.property('lens');
return done();
done();
});
});
});
25 changes: 12 additions & 13 deletions tests/api/v1/perspectives/getWriters.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ const User = tu.db.User;
const getWritersPath = '/v1/perspectives/{key}/writers';
const getWriterPath = '/v1/perspectives/{key}/writers/{userNameOrId}';


describe('api: perspective: get writers', () => {
let perspective;
let token;
Expand All @@ -33,7 +32,7 @@ describe('api: perspective: get writers', () => {
token = returnedToken;
done();
})
.catch((err) => done(err));
.catch(done);
});

before((done) => {
Expand Down Expand Up @@ -63,7 +62,7 @@ describe('api: perspective: get writers', () => {
user = secUsr;
})
.then(() => done())
.catch((err) => done(err));
.catch(done);
});
after(u.forceDelete);
after(tu.forceDeleteUser);
Expand All @@ -78,10 +77,10 @@ describe('api: perspective: get writers', () => {
})
.end((err /* , res */) => {
if (err) {
return done(err);
done(err);
}

return done();
done();
});
});

Expand All @@ -100,10 +99,10 @@ describe('api: perspective: get writers', () => {
})
.end((err /* , res */) => {
if (err) {
return done(err);
done(err);
}

return done();
done();
});
});

Expand All @@ -118,10 +117,10 @@ describe('api: perspective: get writers', () => {
})
.end((err /* , res */) => {
if (err) {
return done(err);
done(err);
}

return done();
done();
});
});

Expand All @@ -136,10 +135,10 @@ describe('api: perspective: get writers', () => {
})
.end((err /* , res */) => {
if (err) {
return done(err);
done(err);
}

return done();
done();
});
});

Expand All @@ -150,10 +149,10 @@ describe('api: perspective: get writers', () => {
.expect(constants.httpStatus.NOT_FOUND)
.end((err /* , res */) => {
if (err) {
return done(err);
done(err);
}

return done();
done();
});
});
});
28 changes: 14 additions & 14 deletions tests/api/v1/perspectives/patch.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe(`api: PATCH ${path}`, () => {
token = returnedToken;
done();
})
.catch((err) => done(err));
.catch(done);
});

before((done) => {
Expand All @@ -47,7 +47,7 @@ describe(`api: PATCH ${path}`, () => {
perspectiveId = createdPersp.id;
done();
})
.catch((err) => done(err));
.catch(done);
});

after(u.forceDelete);
Expand All @@ -60,11 +60,11 @@ describe(`api: PATCH ${path}`, () => {
.expect(constants.httpStatus.OK)
.end((err, res) => {
if (err) {
return done(err);
done(err);
}

expect(res.body.rootSubject).to.equal('changedMainSubject');
return done();
done();
});
});

Expand All @@ -75,11 +75,11 @@ describe(`api: PATCH ${path}`, () => {
.expect(constants.httpStatus.OK)
.end((err, res) => {
if (err) {
return done(err);
done(err);
}

expect(res.body.aspectTagFilter).to.eql(['ctemp', 'chum']);
return done();
done();
});
});

Expand All @@ -92,10 +92,10 @@ describe(`api: PATCH ${path}`, () => {
.expect(constants.httpStatus.BAD_REQUEST)
.end((err /* , res */) => {
if (err) {
return done(err);
done(err);
}

return done();
done();
});
});

Expand All @@ -108,10 +108,10 @@ describe(`api: PATCH ${path}`, () => {
.expect(constants.httpStatus.BAD_REQUEST)
.end((err /* , res */) => {
if (err) {
return done(err);
done(err);
}

return done();
done();
});
});

Expand All @@ -124,10 +124,10 @@ describe(`api: PATCH ${path}`, () => {
.expect(constants.httpStatus.BAD_REQUEST)
.end((err /* , res */) => {
if (err) {
return done(err);
done(err);
}

return done();
done();
});
});

Expand All @@ -140,10 +140,10 @@ describe(`api: PATCH ${path}`, () => {
.expect(constants.httpStatus.BAD_REQUEST)
.end((err /* , res */) => {
if (err) {
return done(err);
done(err);
}

return done();
done();
});
});
});
Loading

0 comments on commit 8eedd07

Please sign in to comment.