TheOdinProject/javascript-exercises

helloWorld exercise test failes!

oscarwanker opened this issue · 0 comments

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)