Skip to content
Snippets Groups Projects
Select Git revision
  • 03f612937ddd56ec60ac4d465996eeead1c3f734
  • master default
2 results

todo-client-tests

user avatar
Mathias Picker authored
03f61293
History

Client tests example

Setup database connections

You need to create two configuration files that will contain the database connection details. These files should not be uploaded to your git repository, and they have therefore been added to .gitignore. The connection details may vary, but example content of the two configuration files are as follows:

server/src/config.js:

// @flow

process.env.MYSQL_HOST = 'mysql.stud.ntnu.no';
process.env.MYSQL_USER = 'username_todo';
process.env.MYSQL_PASSWORD = 'username_todo';
process.env.MYSQL_DATABASE = 'username_todo_dev';

server/test/config.js:

// @flow

process.env.MYSQL_HOST = 'mysql.stud.ntnu.no';
process.env.MYSQL_USER = 'username_todo';
process.env.MYSQL_PASSWORD = 'username_todo';
process.env.MYSQL_DATABASE = 'username_todo_test';

These environment variables will be used in the server/src/mysql-pool.js file.

Start server

Install dependencies and start server:

cd server
npm install
npm start

Run server tests:

npm test

Bundle client files to be served through server

Install dependencies and bundle client files:

cd client
npm install
npm start

Run client tests:

npm test