Files
freeCodeCamp/curriculum/challenges/chinese/06-information-security-and-quality-assurance/quality-assurance-and-testing-with-chai/assert-deep-equality-with-.deepequal-and-.notdeepequal.chinese.md

57 lines
2.0 KiB
Markdown
Raw Normal View History

---
id: 587d824c367417b2b2512c4c
title: Assert Deep Equality with .deepEqual and .notDeepEqual
challengeType: 2
isHidden: false
forumTopicId: 301587
localeTitle: 用 Assert.deepEqual() 和 Assert.notDeepEqual() 断言深度相等
---
## Description
<section id='description'>
注意,本项目在 <a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-infosec/'>这个 Glitch 项目</a> 的基础上进行开发。你也可以从 <a href='https://github.com/freeCodeCamp/boilerplate-infosec/'>GitHub</a> 上克隆。
.deepEqual().notDeepEqual()
<code>deepEqual()</code> 断言两个对象是否 deep equal
</section>
## Instructions
<section id='instructions'>
<code>assert.deepEqual()</code> 或者 <code>assert.notDeepEqual()</code> 通过测试
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: 需通过全部测试
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=6').then(data => {assert.equal(data.state,'passed'); }, xhr => { throw new Error(xhr.responseText); })
- text: 请选择正确的断言--deepEqual 或 notDeepEqual
testString: 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); })
- text: 请选择正确的断言--deepEqual 或 notDeepEqual
testString: 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); })
```
</section>
## Challenge Seed
<section id='challengeSeed'>
</section>
## Solution
<section id='solution'>
```js
/**
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.
*/
```
</section>