diff --git a/.env b/.env deleted file mode 100644 index 4d0568c..0000000 --- a/.env +++ /dev/null @@ -1,14 +0,0 @@ -HOST=127.0.0.1 -PORT=3333 -NODE_ENV=development -APP_NAME=AdonisJs -APP_URL=http://${HOST}:${PORT} -CACHE_VIEWS=false -APP_KEY=P9l5RprfiU5ouAu7CQwydednqJZRXTkY -DB_CONNECTION=sqlite -DB_HOST=127.0.0.1 -DB_PORT=3306 -DB_USER=root -DB_PASSWORD= -DB_DATABASE=adonis -HASH_DRIVER=bcrypt \ No newline at end of file diff --git a/.gitignore b/.gitignore index d686a1f..04b86e2 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ node_modules tmp # Environment variables, never commit this file +.env .env-test # The development sqlite file diff --git a/package.json b/package.json index 5e6005d..0e2aefd 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ "husky": { "hooks": { "pre-commit": "npm run lint", + "pre-push": "npm test", "post-merge": "npm install && adonis migration:run && adonis key:generate" } }, diff --git a/test/functional/registeruser.spec.js b/test/functional/registeruser.spec.js index e330097..9dcbb8f 100644 --- a/test/functional/registeruser.spec.js +++ b/test/functional/registeruser.spec.js @@ -10,20 +10,18 @@ test('it should be able to register user to the database', async ({ assert, client, }) => { - const sessionPayload = { + const user = { username: 'JohnDoe', name: 'John Doe', email: 'joe@example.com', password: '123456', } - await Factory.model('App/Models/User').create(sessionPayload) - const response = await client .post('/register') - .send(sessionPayload) + .send(user) .end() response.assertStatus(201) - assert.exists(response) + assert.exists(user) })