Why does Exercism test for state mutation?
See original GitHub issueIn 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:
- Created 2 years ago
- Comments:10 (7 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I think those changes in description make it clearer.
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.