How to use the test systems - AvengerDisassemble/KU-connect GitHub Wiki

Test Structure

The testing structure mirrors the src folder, which contains most of the logic of the backend project. So each testing file in there is the mirror of the real file. For example, the src in the project folder might look like this:

/project-root
│
├── /src                   
│   ├── /routes           
|       ├── /folder
|           ├── /routeA.js 
│   ├── /models     
|       ├── /modelA.js
│   ├── /services
|       ├── /serviceA.js
│   └── app.js  

The testing folder will look like this:

/tests
│
├── /src                   
│   ├── /routes           
|       ├── /folder
|           ├── /routeA.test.js 
│   ├── /models     
|       ├── /modelA.test.js
│   ├── /services
|       ├── /serviceA.test.js
│   └── app.test.js  

How to use it

/**
 * @fileoverview Unit tests for example-database-usage/example.js route
 * @author KU Connect Team
 */

const assert = require('assert')
// ...existing code...
describe('example-database-usage/example.js route', () => {
  it('should have tests implemented', () => {
    assert.ok(true)
  })
})

Simply mirroring the file that you are working on is considered sufficient for now.

How to run

npm run test