question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Why does Exercism test for state mutation?

See original GitHub issue

In JS track Bird Watcher exercise Test 9 is testing for object equality. The only way for me to pass the test is to mutate the array. My initial solution where I returned a new array with the modified value triggers this test failure. It means that my map solution was not accepted. Is this intended behaviour?

const birdsPerDay = [2, 0, 1, 4, 1, 3, 0];
expect(Object.is(fixBirdCountLog(birdsPerDay), birdsPerDay)).toBe(true);
Error: expect(received).toBe(expected) // Object.is equality
Expected: true
Received: false

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
arnthorsnaercommented, Jan 3, 2022

I think those changes in description make it clearer.

2reactions
junedevcommented, Jan 3, 2022

I think in other exercises we say “returns the modified array” (or object in other contexts). That might help here as well. In general I think it makes sense to have a task that uses a for loop and mutates an array as it is a common use case.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Software Testing Syntax-Based Coverage and Mutation Testing
Why learn about mutation testing? • The “P” in the RIPR model. • Check whether errors are propagating to the state that test...
Read more >
Exercise: Avoiding mutation / Anjana Vakil - Observable
Mutable data and mutating functions/methods allow us to change things in place - meaning we have values changing over time, aka state -...
Read more >
Frequently asked questions | Exercism's Docs
How do I check the version of my command-line client? The version command exercism version outputs the running version of the Exercism command-line...
Read more >
Mutation Analysis - The Fuzzing Book
The idea of mutation analysis is to seed artificial faults, known as mutations, into the program code, and to check whether the test...
Read more >
Mutation Testing: Automate the Search for Imperfect Tests
Line coverage identifies code that is definitely not tested. If there is no test coverage for the line of code where a mutant...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found