# FAQ: Learn TDD With Mocha - Getting Into The Red I

This community-built FAQ covers the “Getting Into The Red I” exercise from the lesson “Learn TDD With Mocha”.

Paths and Courses
This exercise can be found in the following Codecademy content:

## FAQs on the exercise Getting Into The Red I

There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply () below.

If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.

## Join the Discussion. Help a fellow learner on their journey.

Agree with a comment or answer? Like () to up-vote the contribution!

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

This nodule is requiring me to write code that is in direct contradiction to the best practice described by the Test Phases module.

Here’s the code I want to write:

``````const assert = require('assert');
const Calculate =  require('../index.js')

describe('Calculate', () => {
describe('.sum',() => {
it('returns the sum of an array of numbers', () => {
// Code here
const array = [1,2,3];
const expected = 6;

const actual = Calculate.sum(array);

accept.equal(actual,expected);
});
});
});
``````

But here’s the code I need to write to pass it:

``````const assert = require('assert');
const Calculate =  require('../index.js')

describe('Calculate', () => {
describe('.sum',() => {
it('returns the sum of an array of numbers', () => {
// Code here
assert.equal(Calculate.sum([1,2,3]),6)
});
});
});
``````

Or am I missing something?

8 Likes

I totally agree!
Either one should be best practise.

Yeah, why can’t I use?

``````const assert = require('assert');
const Calculate =  require('../index.js')

describe('Calculate', () => {
describe('.sum',() => {
it('returns the sum of an array of numbers', () => {
//setup
let expected = 6

//exercise
let test = Calculate.sum([1,2,3])

//verify
assert.equal(test, expected)
});
});
});
``````

It’s requiring me to use:

``````const assert = require('assert');
const Calculate =  require('../index.js')

describe('Calculate', () => {
describe('.sum',() => {
it('returns the sum of an array of numbers', () => {
assert.equal(Calculate.sum([1,2,3]), 6);
});
});
});
``````
1 Like

Completely agree.

This is something that I’ve noticed is quite common in the lessons I’ve done so far. We’re taught “x, y, and z are best practices, strive to be a good developer by doing this” and the tasks immediately require us to break these best practices and do “a, b and c”.

Not sure if this is done intentionally to prepare us for the real world – assuming that most developers we will work alongside are cowboys that do whatever they want with no regard for accurate and organised code.

``````if (true) {
console.log('kudos to them')
} else {
console.log('why is it so inconsistent?');
};
``````

Maybe it’s the case that we should be aware of best practices and implementing them in comments in order to practice them for our own benefit, and giving the lessons what they ask for to fulfil the exercise requirements.

4 Likes

This seems like a plausible reason, or at least an unintended benefit; being exposed to good and bad practices and being able to work with them both.

1 Like