Skip to content

Object Basics (foundations) fibonacci issue #692

Description

@Duality-TOP

Checks

Describe your suggestion

at the readme it is stated that:

'If given a negative number, NaN, or not a number type at all, the function should return "OOPS", i.e. only proceed with positive numbers.'

meanwhile, the .spec.js (test file) has an error on its writing

const fibonacci = require('./fibonacci')

describe('fibonacci', () => {
test('4th fibonacci number is 3', () => {
expect(fibonacci(4)).toBe(3);
});
test.skip('6th fibonacci number is 8', () => {
expect(fibonacci(6)).toBe(8);
});
test.skip('10th fibonacci number is 55', () => {
expect(fibonacci(10)).toBe(55);
});
test.skip('15th fibonacci number is 610', () => {
expect(fibonacci(15)).toBe(610);
});
test.skip('25th fibonacci number is 75025', () => {
expect(fibonacci(25)).toBe(75025);
});
test.skip('0th fibonacci number is 0', () => {
expect(fibonacci(0)).toBe(0);
});
test.skip('doesn't accept negatives', () => {
expect(fibonacci(-25)).toBe("OOPS");
});
test.skip('doesn't accept NaN', () => {
expect(fibonacci(NaN)).toBe("OOPS");
});
test.skip('doesn't accept non-numbers types', () => {
expect(fibonacci("0")).toBe("OOPS");
expect(fibonacci([])).toBe("OOPS");
expect(fibonacci({})).toBe("OOPS");
});
})

if read correctly, negative numbers should return 'NaN', meanwhile non-numbers should return 'OOPS'. the test file does not cover the posibility of a negative number returning 'NaN'

Path

Foundations

Lesson Url

https://www.theodinproject.com/lessons/foundations-object-basics

(Optional) Discord Name

No response

(Optional) Additional Comments

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions