mirror of
https://github.com/verdaccio/verdaccio.git
synced 2024-12-16 21:56:25 -05:00
test: add unit test for whoami referer endpoint
This commit is contained in:
parent
450224dc1f
commit
4242eaa6b8
1 changed files with 19 additions and 4 deletions
|
@ -80,12 +80,27 @@ describe('endpoint unit test', () => {
|
|||
});
|
||||
|
||||
describe('should test whoami api', () => {
|
||||
test('should test referer /whoami endpoint', (done) => {
|
||||
request(app)
|
||||
.get('/whoami')
|
||||
.set('referer', 'whoami')
|
||||
.expect(HTTP_STATUS.OK)
|
||||
.end(done);
|
||||
});
|
||||
|
||||
test('should test no referer /whoami endpoint', (done) => {
|
||||
request(app)
|
||||
.get('/whoami')
|
||||
.expect(HTTP_STATUS.NOT_FOUND)
|
||||
.end(done);
|
||||
});
|
||||
|
||||
test('should test /-/whoami endpoint', (done) => {
|
||||
request(app)
|
||||
.get('/-/whoami')
|
||||
.expect(HEADER_TYPE.CONTENT_TYPE, HEADERS.JSON_CHARSET)
|
||||
.expect(HTTP_STATUS.OK)
|
||||
.end(function(err, res) {
|
||||
.end(function(err) {
|
||||
if (err) {
|
||||
return done(err);
|
||||
}
|
||||
|
@ -98,7 +113,7 @@ describe('endpoint unit test', () => {
|
|||
.get('/-/whoami')
|
||||
.expect(HEADER_TYPE.CONTENT_TYPE, HEADERS.JSON_CHARSET)
|
||||
.expect(HTTP_STATUS.OK)
|
||||
.end(function(err, res) {
|
||||
.end(function(err) {
|
||||
if (err) {
|
||||
return done(err);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue