Initial commit.
This commit is contained in:
commit
b48a4e92e1
169 changed files with 7538 additions and 0 deletions
62
test/api/user.spec.js
Normal file
62
test/api/user.spec.js
Normal file
|
@ -0,0 +1,62 @@
|
|||
import assert from 'assert';
|
||||
import { agent } from 'supertest';
|
||||
import app from '../../api/app';
|
||||
|
||||
const request = agent(app.listen());
|
||||
|
||||
describe('hostr-api user', function() {
|
||||
|
||||
describe('when GET /user', function() {
|
||||
it('should receive a user object', function(done) {
|
||||
request
|
||||
.get('/user')
|
||||
.auth('test@hostr.co', 'test-password')
|
||||
.expect(function(response) {
|
||||
assert(response.body.id === '54fd04a37675bcd06213eac8');
|
||||
})
|
||||
.expect(200)
|
||||
.end(done);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when GET /user/token', function() {
|
||||
it('should receive a user token object', function(done) {
|
||||
request
|
||||
.get('/user/token')
|
||||
.auth('test@hostr.co', 'test-password')
|
||||
.expect(function(response) {
|
||||
assert(response.body.token);
|
||||
})
|
||||
.expect(200)
|
||||
.end(done);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when GET /user/transaction', function() {
|
||||
it('should receive a user transactions object', function(done) {
|
||||
request
|
||||
.get('/user/transaction')
|
||||
.auth('test@hostr.co', 'test-password')
|
||||
.expect(200)
|
||||
.expect(function(response) {
|
||||
assert(response.body instanceof Array);
|
||||
})
|
||||
.end(done);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when GET /user/settings', function() {
|
||||
it('should update user password', function(done) {
|
||||
request
|
||||
.post('/user/settings')
|
||||
.send({'current_password': 'test-password', 'new_password': 'test-password' })
|
||||
.auth('test@hostr.co', 'test-password')
|
||||
.expect(200)
|
||||
.expect(function(response) {
|
||||
assert(response.body instanceof Object);
|
||||
})
|
||||
.end(done);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue