Coder Social home page Coder Social logo

intro-node-js's Issues

Suggestion

I would suggest to add .nvmrc.
npm i doesn't work properly for me with node v12

Trying to follow along

I am at fixing modules and I followed the same and even tried to replace it with the solution but it did not work.

data › users

expect(received).toHaveLength(expected)

Matcher error: received value must have a length property whose value 

must be a number

Received has value: undefined

   5 | describe('data', () => {
   6 |   test('users',  () => {
>  7 |     expect(data.users).toHaveLength(1)
     |                        ^
   8 |   })
   9 |   test('posts', () => {
  10 |     expect(data.posts).toHaveLength(3)

  at Object.toHaveLength (exercises/modules/node/test.js:7:24)

● data › posts

expect(received).toHaveLength(expected)

Matcher error: received value must have a length property whose value must be a number

Received has value: undefined

   8 |   })
   9 |   test('posts', () => {
> 10 |     expect(data.posts).toHaveLength(3)
     |                        ^
  11 |   })
  12 | })
  13 | 

  at Object.toHaveLength (exercises/modules/node/test.js:10:24)

● api › getUserById

TypeError: Cannot read property 'find' of undefined

  4 |   // simulate API call
  5 |   setTimeout(() => {
> 6 |     const user = data.users.find(user => user.id === id)
    |                             ^
  7 |     cb(user)
  8 |   }, 150)
  9 | }

  at find (exercises/modules/node/api.js:6:29)
  at Timeout.callback [as _onTimeout] (node_modules/jsdom/lib/jsdom/browser/Window.js:671:19)

● api › getUserById

expect.assertions(1)

Expected one assertion to be called but received zero assertion calls.

  14 | describe('api', () => {
  15 |   test('getUserById', done => {
> 16 |     expect.assertions(1)
     |            ^
  17 |     api.getUserById(1, user => {
  18 |       expect(user.id).toBe(1)
  19 |       done()

  at Object.assertions (exercises/modules/node/test.js:16:12)

● api › getPostsForUser

TypeError: Cannot read property 'filter' of undefined

  12 |   // simulate API call
  13 |   setTimeout(() => {
> 14 |     const posts = data.posts.filter(post => post.createdBy === userId)
     |                              ^
  15 |     cb(posts)
  16 |   }, 150)
  17 | }

  at filter (exercises/modules/node/api.js:14:30)
  at Timeout.callback [as _onTimeout] (node_modules/jsdom/lib/jsdom/browser/Window.js:671:19)

● app › showPostsForCurrentUser

TypeError: Cannot read property 'filter' of undefined

  12 |   // simulate API call
  13 |   setTimeout(() => {
> 14 |     const posts = data.posts.filter(post => post.createdBy === userId)
     |                              ^
  15 |     cb(posts)
  16 |   }, 150)
  17 | }

  at filter (exercises/modules/node/api.js:14:30)
  at Timeout.callback [as _onTimeout] (node_modules/jsdom/lib/jsdom/browser/Window.js:671:19)

● app › showUserProfile

TypeError: Cannot read property 'find' of undefined

  4 |   // simulate API call
  5 |   setTimeout(() => {
> 6 |     const user = data.users.find(user => user.id === id)
    |                             ^
  7 |     cb(user)
  8 |   }, 150)
  9 | }

  at find (exercises/modules/node/api.js:6:29)
  at Timeout.callback [as _onTimeout] (node_modules/jsdom/lib/jsdom/browser/Window.js:671:19)

Test Suites: 2 failed, 2 total
Tests: 6 failed, 6 total
Snapshots: 0 total
Time: 1.813s, estimated 2s
Ran all test suites.

NVM not working with PowerShell

Hello, I have PowerShell in the terminal, because I can't install Bash, and I can't install nvm. I installed node(14.08.0) from the website and I can run npm install but none of the nvm commands work. any advice please?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.