unit test jest supertest code example
Example 1: jest supertest
import request from 'supertest';
import app from '../app';
describe('App', () => {
it('/', () => {
return request(app)
.get('/')
.expect(200);
});
});
Example 2: jest supertest
const request = require('supertest');
const app = require('../app');
describe('App', () => {
it('/', () => {
return request(app)
.get('/')
.expect(200);
});
});