Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

helloWorld exercise test failes! #159

Closed
oscarwanker opened this issue Jun 19, 2021 · 0 comments
Closed

helloWorld exercise test failes! #159

oscarwanker opened this issue Jun 19, 2021 · 0 comments

Comments

@oscarwanker
Copy link

oscarwanker commented Jun 19, 2021

helloWorld.js file:

const helloWorld = function() {
  return 'Hello, World!'
};

module.exports = helloWorld;

helloWorld.spec.js file:

const helloWorld = require('./helloWorld').default;

describe('Hello World', function() {
  test('says "Hello, World!"', function() {
    expect(helloWorld()).toEqual('Hello, World!');
  });
});

when i run the test it tells me it fails anyways:

> javascript-exercises@1.0.0 test
> jest "helloWorld.spec.js"

 FAIL  helloWorld/helloWorld.spec.js
  Hello World
    ✕ says "Hello, World!" (2 ms)

  ● Hello World › says "Hello, World!"

    TypeError: helloWorld is not a function

      3 | describe('Hello World', function() {
      4 |   test('says "Hello, World!"', function() {
    > 5 |     expect(helloWorld()).toEqual('Hello, World!');
        |            ^
      6 |   });
      7 | });
      8 |

      at Object.<anonymous> (helloWorld/helloWorld.spec.js:5:12)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant