NODE JS vidly : GET / in genres.test.js does not pass.( picture attached)

I am at Intergration Test ,

            >   >  describe('GET /', () => {
                    it('should return all genres', async () => {
                      const genres = [
                        { name: 'genre1' },
                        { name: 'genre2' },
                  await Genre.collection.insertMany(genres);

                  const res = await request(server).get('/api/genres');
                  expect(res.body.some(g => === 'genre1')).toBeTruthy();
                  expect(res.body.some(g => === 'genre2')).toBeTruthy();

in genres.test.js does not pass.Preformatted text

when I check MongoDB compass, there are only 2 genres in collection.

I try to download the sample code from Mosh, It also does not pass ( I attached picture), someone face the same problem? have any idea to solve it?

thank in advance.

Hi, I’m getting a similar error but mine fails at the first expect(res.status).toBe(200) line. Heres a screenshot :

I cant seem to figure it out.

Figured it out, had bufferCommands set to false.


Where exactly did you set this option?
I have the same problem and I can’t figure it out.

Thank you

Hi Vlad,

it was set in the mongodb call:
Screenshot 2021-03-16 at 17.03.41

hope this works for you.