create-sipere 0.9.3 → 0.9.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import Sequelize from 'sequelize'
|
|
2
2
|
import dotenvFlow from 'dotenv-flow'
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
dotenvFlow.config({ path: '.env.test' })
|
|
6
|
-
}else {
|
|
7
|
-
dotenvFlow.config()
|
|
8
|
-
}
|
|
4
|
+
dotenvFlow.config()
|
|
9
5
|
|
|
10
6
|
const sequelize = new Sequelize(
|
|
11
7
|
process.env.DB_NAME,
|
|
@@ -5,8 +5,8 @@ describe('/api/register and /api/login', () => {
|
|
|
5
5
|
const restype= 'application/json; charset=utf-8'
|
|
6
6
|
var token = null
|
|
7
7
|
|
|
8
|
-
it('post /register ',
|
|
9
|
-
supertest(app)
|
|
8
|
+
it('post /register ', async () => {
|
|
9
|
+
await supertest(app)
|
|
10
10
|
.post('/api/register')
|
|
11
11
|
.set('Accept', 'application/json')
|
|
12
12
|
.send({
|
|
@@ -16,11 +16,11 @@ describe('/api/register and /api/login', () => {
|
|
|
16
16
|
password_confirmation: 'titok'
|
|
17
17
|
})
|
|
18
18
|
.expect('Content-Type', restype)
|
|
19
|
-
.expect(201
|
|
19
|
+
.expect(201)
|
|
20
20
|
|
|
21
21
|
})
|
|
22
|
-
it('post /login ', (
|
|
23
|
-
supertest(app)
|
|
22
|
+
it('post /login ', async () => {
|
|
23
|
+
const res = await supertest(app)
|
|
24
24
|
.post('/api/login')
|
|
25
25
|
.set('Accept', 'application/json')
|
|
26
26
|
.send({
|
|
@@ -28,16 +28,17 @@ describe('/api/register and /api/login', () => {
|
|
|
28
28
|
password: 'titok'
|
|
29
29
|
})
|
|
30
30
|
.expect('Content-Type', restype)
|
|
31
|
-
.expect(200
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
.expect(200)
|
|
32
|
+
token = res.body.accessToken
|
|
33
|
+
if(!token) {
|
|
34
|
+
throw new Error('No token')
|
|
35
|
+
}
|
|
35
36
|
})
|
|
36
|
-
it('get /users ',
|
|
37
|
-
supertest(app)
|
|
37
|
+
it('get /users ', async () => {
|
|
38
|
+
await supertest(app)
|
|
38
39
|
.get('/api/users')
|
|
39
40
|
.set('Accept', 'application/json')
|
|
40
41
|
.set('Authorization', 'Bearer ' + token)
|
|
41
|
-
.expect(200
|
|
42
|
+
.expect(200)
|
|
42
43
|
})
|
|
43
44
|
})
|