-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature(share-articles): Use util helper fuctions [Finishes #167313416]
- Loading branch information
1 parent
45cf47f
commit 82142a8
Showing
3 changed files
with
80 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,50 @@ | ||
// import { chai, server, expect } from './test-setup'; | ||
// import Helper from '../src/helpers/helper'; | ||
import { chai, server, expect } from './test-setup'; | ||
import Helper from '../src/helpers/helper'; | ||
|
||
// const usertoken = Helper.generateToken({ | ||
// id: 2, | ||
// email: 'user@gmail.com', | ||
// username: 'user', | ||
// verified: false | ||
// }); | ||
const usertoken = Helper.generateToken({ | ||
id: 2, | ||
email: 'user@gmail.com', | ||
username: 'user', | ||
verified: false | ||
}); | ||
|
||
// describe('search article query builder', () => { | ||
// it('List of all articles', (done) => { | ||
// chai | ||
// .request(server) | ||
// .get('/api/v1/articles') | ||
// .set('Content-Type', 'application/json') | ||
// .set('Authorization', usertoken) | ||
// .end((err, res) => { | ||
// expect(res.status).to.be.deep.equal(200); | ||
// expect(res.body).to.have.deep.property('message', 'List of all articles'); | ||
// }); | ||
// done(); | ||
// }); | ||
// it('Title and description in the query', (done) => { | ||
// chai | ||
// .request(server) | ||
// .get('/api/v1/articles?title=Title&&keyword=here') | ||
// .set('Content-Type', 'application/json') | ||
// .set('Authorization', usertoken) | ||
// .end((err, res) => { | ||
// if (err) done(err); | ||
// expect(res.status).to.be.deep.equal(200); | ||
// expect(res.body).to.have.deep.property('message', 'List of all articles'); | ||
// }); | ||
// done(); | ||
// }); | ||
// it('if invalid query key', (done) => { | ||
// chai | ||
// .request(server) | ||
// .get('/api/v1/articles?key=Tilltle') | ||
// .set('Content-Type', 'application/json') | ||
// .set('Authorization', usertoken) | ||
// .end((err, res) => { | ||
// if (err) done(err); | ||
// expect(res.status).to.be.deep.equal(400); | ||
// expect(res.body).to.have.deep.property('error'); | ||
// }); | ||
// done(); | ||
// }); | ||
// }); | ||
describe('search article query builder', () => { | ||
it('List of all articles', (done) => { | ||
chai | ||
.request(server) | ||
.get('/api/v1/articles') | ||
.set('Content-Type', 'application/json') | ||
.set('Authorization', usertoken) | ||
.end((err, res) => { | ||
expect(res.status).to.be.deep.equal(200); | ||
expect(res.body).to.have.deep.property('message', 'List of all articles'); | ||
done(); | ||
}); | ||
}); | ||
it('Title and description in the query', (done) => { | ||
chai | ||
.request(server) | ||
.get('/api/v1/articles?title=Title&&keyword=here') | ||
.set('Content-Type', 'application/json') | ||
.set('Authorization', usertoken) | ||
.end((err, res) => { | ||
if (err) done(err); | ||
expect(res.status).to.be.deep.equal(200); | ||
expect(res.body).to.have.deep.property('message', 'List of all articles'); | ||
done(); | ||
}); | ||
}); | ||
it('if invalid query key', (done) => { | ||
chai | ||
.request(server) | ||
.get('/api/v1/articles?key=Tilltle') | ||
.set('Content-Type', 'application/json') | ||
.set('Authorization', usertoken) | ||
.end((err, res) => { | ||
if (err) done(err); | ||
expect(res.status).to.be.deep.equal(400); | ||
expect(res.body).to.have.deep.property('error'); | ||
done(); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters