mercredi 19 août 2020

How can i test my sails application with mocha and supertest?

i have this structure, i have a test to an service, and configuration mocha and bootstrap, i am using mocha and supertest

-api
-test
 -services
   *mytest.test.js
 *mocha.opts
 *bootstrap.test.js

i have installed:

  • npm install --save-dev mocha
  • npm install supertest --save-dev

this is my test (mytest.test.js)

const assert = require('assert')
require('../../bootstrap');
describe('Teacher.service tests', () => {
  let teacher

  before(async () => {
    teacher = await Teacher.create({
      name: 'Kate'
    }).fetch()
  })
  after(async () => {
    await Teacher.destroy({})
  })

  it('test', async () => {
    assert.equal(1, 1)
  })
})

i try to use mocha with yarn mocha but only i am getting

0 passing (2ms)

✨  Done in 0.70s.

Aucun commentaire:

Enregistrer un commentaire