2.1 KiB
2.1 KiB
id, title, challengeType, forumTopicId, dashedName
id | title | challengeType | forumTopicId | dashedName |
---|---|---|---|---|
587d824c367417b2b2512c4c | Asserire l'uguaglianza profonda con .deepEqual e .notDeepEqual | 2 | 301587 | assert-deep-equality-with--deepequal-and--notdeepequal |
--description--
Come promemoria, questo progetto verrà costruito a partire dalla seguente bozza su Replit, o clonato da GitHub.
deepEqual()
afferma che due oggetti sono uguali in maniera profonda.
--instructions--
All'interno di tests/1_unit-tests.js
, sotto il test etichettato con #7
, nella suite Equality
, cambia ogni asserzione assert
in assert.deepEqual
o assert.notDeepEqual
per far superare il test (dovrebbe risultare true
). Non alterare gli argomenti passati alle asserzioni.
--hints--
Tutti i test dovrebbero essere superati.
(getUserInput) =>
$.get(getUserInput('url') + '/_api/get-tests?type=unit&n=6').then(
(data) => {
assert.equal(data.state, 'passed');
},
(xhr) => {
throw new Error(xhr.responseText);
}
);
Dovresti scegliere il metodo corretto per la prima asserzione - deepEqual
oppure notDeepEqual
.
(getUserInput) =>
$.get(getUserInput('url') + '/_api/get-tests?type=unit&n=6').then(
(data) => {
assert.equal(
data.assertions[0].method,
'deepEqual',
'The order of the keys does not matter'
);
},
(xhr) => {
throw new Error(xhr.responseText);
}
);
Dovresti scegliere il metodo corretto per la seconda asserzione - deepEqual
oppure notDeepEqual
.
(getUserInput) =>
$.get(getUserInput('url') + '/_api/get-tests?type=unit&n=6').then(
(data) => {
assert.equal(
data.assertions[1].method,
'notDeepEqual',
'The position of elements within an array does matter'
);
},
(xhr) => {
throw new Error(xhr.responseText);
}
);
--solutions--
/**
Backend challenges don't need solutions,
because they would need to be tested against a full working project.
Please check our contributing guidelines to learn more.
*/