I'm getting 'Uncaught TypeError: Cannot read properties of undefined (reading 'should')' when running the following. Why is that?
const {
expect
} = require('chai');
const chai = require('chai');
const chaiHTTP = require('chai-http');
const should = chai.should()
chai.use(chaiHTTP);
//tester om man kan oprette annonce med rigtigt UserId
const endPoint = 'http://localhost:1000/lavAnnonce'
describe(`POST new user ${endPoint}`, () => {
it(`should post a new Annonce`, (done) => {
const payload = {
title: 'DALDSADW',
price: 50,
location: 'hovedstaden',
category: 'sko',
colour: 'sort',
billede: 'findes ikke',
user_id: '180'
};
chai
.request(endPoint)
.post("")
.set("content-type", "application/json")
.send(payload)
.end((err, response) => {
response.should.have.status(200)
done();
});
});
});