Skip to content

Commit 5e30735

Browse files
testing
1 parent f701d81 commit 5e30735

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

tests/userActions.test.js

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import {server} from '../app'
22
import axios from 'axios'
3-
// axios.defaults.baseURL = `http://localhost:4000`
43
import MockAdapter from 'axios-mock-adapter';
5-
// const baseUrl = `http://localhost:4000`
64
const mock = new MockAdapter(axios);
75

6+
import UserActionController from '../src/controllers/UserActionController'
7+
88
//After all the tests are done we're going to close our server
99
//and rollback our database.
1010
afterAll(async () => {
@@ -15,24 +15,27 @@ afterAll(async () => {
1515
});
1616

1717
describe('user account actions', () => {
18+
const userActionController = new UserActionController()
1819

1920
it('signs up a user', async () => {
2021
mock.onPost('/api/v1/user/signup').reply(function() {
2122
return [200, { foo: 'bar' }];
2223
});
2324

24-
// axios.get('/foo1')
25-
// .then(function(response) {
26-
// console.log(response.data);
27-
// expect(response.status).toBe(200)
28-
// })
29-
// .catch(function(error) {
30-
// throw new Error(error)
31-
// })
32-
33-
3425
expect.assertions(1)
35-
const response = await axios.post('/api/v1/user/signup')
26+
//const response = await axios.post('/api/v1/user/signup')
27+
let ctx = {
28+
request: {
29+
body: {
30+
"firstName": "John",
31+
"lastName": "Datserakis",
32+
"username": "johndatserakis@gmail.com",
33+
"email": "johndatserakis@gmail.com",
34+
"password": "Houses123993"
35+
}
36+
}
37+
}
38+
const response = await userActionController.signup(ctx);
3639
expect(response.status).toBe(200)
3740
});
3841

0 commit comments

Comments
 (0)