curriculum/challenges/english/blocks/quality-assurance-and-testing-with-chai/587d824b367417b2b2512c4a.md
As a reminder, this project is being built upon the following starter project cloned from <a href="https://github.com/freeCodeCamp/boilerplate-mochachai/" target="_blank" rel="noopener noreferrer nofollow">GitHub</a>.
equal() compares objects using ==.
Within tests/1_unit-tests.js under the test labeled #5 in the Equality suite, change each assert to either assert.equal or assert.notEqual to make the test pass (should evaluate to true). Do not alter the arguments passed to the asserts.
All tests should pass.
const response = await fetch(code + '/_api/get-tests?type=unit&n=4');
if (!response.ok) {
throw new Error(await response.text());
}
const data = await response.json();
assert.equal(data.state, 'passed');
You should choose the correct method for the first assertion - equal vs. notEqual.
const response = await fetch(code + '/_api/get-tests?type=unit&n=4');
if (!response.ok) {
throw new Error(await response.text());
}
const data = await response.json();
assert.equal(
data.assertions[0].method,
'equal',
'Numbers are coerced into strings with == '
);
You should choose the correct method for the second assertion - equal vs. notEqual.
const response = await fetch(code + '/_api/get-tests?type=unit&n=4');
if (!response.ok) {
throw new Error(await response.text());
}
const data = await response.json();
assert.equal(
data.assertions[1].method,
'notEqual',
' == compares object references'
);
You should choose the correct method for the third assertion - equal vs. notEqual.
const response = await fetch(code + '/_api/get-tests?type=unit&n=4');
if (!response.ok) {
throw new Error(await response.text());
}
const data = await response.json();
assert.equal(
data.assertions[2].method,
'equal',
"6 * '2' is 12 ! It should be equal to '12'"
);
You should choose the correct method for the fourth assertion - equal vs. notEqual.
const response = await fetch(code + '/_api/get-tests?type=unit&n=4');
if (!response.ok) {
throw new Error(await response.text());
}
const data = await response.json();
assert.equal(data.assertions[3].method, 'notEqual', "6 + '2' is '62'...");