2.5 KiB
2.5 KiB
id, title, challengeType, forumTopicId, dashedName
id | title | challengeType | forumTopicId | dashedName |
---|---|---|---|---|
587d824c367417b2b2512c4c | Підтвердження глибокої рівності за допомогою .deepEqual та .notDeepEqual | 2 | 301587 | assert-deep-equality-with--deepequal-and--notdeepequal |
--description--
Нагадуємо, що цей проєкт створено на основі наступного стартового проєкту Replit або кальковано з GitHub.
deepEqual()
підтверджує, що два об'єкти дуже однакові.
--instructions--
У межах tests/1_unit-tests.js
під тестом з міткою #7
в наборі Equality
змініть кожний assert
на assert.deepEqual
або assert.notDeepEqual
, щоб полегшити проходження тесту (варто оцінювати як true
). Не змінюйте аргументи, передані до тверджень.
--hints--
Необхідно пройти всі тести.
(getUserInput) =>
$.get(getUserInput('url') + '/_api/get-tests?type=unit&n=6').then(
(data) => {
assert.equal(data.state, 'passed');
},
(xhr) => {
throw new Error(xhr.responseText);
}
);
Потрібно обрати правильний метод для першого твердження deepEqual
або 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);
}
);
Потрібно обрати правильний метод для другого твердження deepEqual
або 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.
*/