fix(i18n): update Chinese translation of quality assurance and testing with chai (#38945)
This commit is contained in:
@ -2,15 +2,23 @@
|
||||
id: 587d824c367417b2b2512c4c
|
||||
title: Assert Deep Equality with .deepEqual and .notDeepEqual
|
||||
challengeType: 2
|
||||
videoUrl: ''
|
||||
localeTitle: 使用.deepEqual和.notDeepEqual断言深度等式
|
||||
isHidden: false
|
||||
forumTopicId: 301587
|
||||
localeTitle: 用 Assert.deepEqual() 和 Assert.notDeepEqual() 断言深度相等
|
||||
---
|
||||
|
||||
## Description
|
||||
<section id="description">提醒一下,这个项目是基于<a href="https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-mochachai/">Glitch</a>的以下入门项目构建的,或者是从<a href="https://github.com/freeCodeCamp/boilerplate-mochachai/">GitHub</a>克隆的。 .deepEqual(),. noDeepEqual()。deepEqual()断言两个对象是深度相等的</section>
|
||||
<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">
|
||||
<section id='instructions'>
|
||||
用 <code>assert.deepEqual()</code> 或者 <code>assert.notDeepEqual()</code> 通过测试
|
||||
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
@ -18,11 +26,11 @@ localeTitle: 使用.deepEqual和.notDeepEqual断言深度等式
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: 所有测试都应该通过
|
||||
- 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 vs. notDeepEqual
|
||||
- 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 vs. notDeepEqual
|
||||
- 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); })
|
||||
|
||||
```
|
||||
@ -38,6 +46,11 @@ tests:
|
||||
<section id='solution'>
|
||||
|
||||
```js
|
||||
// solution required
|
||||
/**
|
||||
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>
|
||||
|
@ -2,15 +2,20 @@
|
||||
id: 587d824c367417b2b2512c4d
|
||||
title: Compare the Properties of Two Elements
|
||||
challengeType: 2
|
||||
videoUrl: ''
|
||||
isHidden: false
|
||||
forumTopicId: 301588
|
||||
localeTitle: 比较两个元素的属性
|
||||
---
|
||||
|
||||
## Description
|
||||
<section id="description">提醒一下,这个项目是基于<a href="https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-mochachai/">Glitch</a>的以下入门项目构建的,或者是从<a href="https://github.com/freeCodeCamp/boilerplate-mochachai/">GitHub</a>克隆的。 .isAbove()=> a> b,.isAtMost()=> a <= b </section>
|
||||
<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> 上克隆。
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
<section id="instructions">
|
||||
<section id='instructions'>
|
||||
|
||||
使用 <code>assert.isAbove()</code> (如 greater) 或者 <code>assert.isAtMost()</code> (如 less than 或者 equal) 通过测试。
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
@ -18,15 +23,15 @@ localeTitle: 比较两个元素的属性
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: 所有测试都应该通过
|
||||
- text: 需通过全部测试
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=7').then(data => {assert.equal(data.state,'passed'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
- text: 选择正确的断言 - isAbove vs. isAtMost
|
||||
- text: 请选择正确的断言--isAbove 或 isAtMost
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=7').then(data => { assert.equal(data.assertions[0].method, 'isAtMost', '5 is at most (<=) 5'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
- text: 选择正确的断言 - isAbove vs. isAtMost
|
||||
- text: 请选择正确的断言--isAbove 或 isAtMost
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=7').then(data => { assert.equal(data.assertions[1].method, 'isAbove', '1 is greater than 0'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
- text: 选择正确的断言 - isAbove vs. isAtMost
|
||||
- text: 请选择正确的断言--isAbove 或 isAtMost
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=7').then(data => { assert.equal(data.assertions[2].method, 'isAbove', 'Math.PI = 3.14159265 is greater than 3'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
- text: 选择正确的断言 - isAbove vs. isAtMost
|
||||
- text: 请选择正确的断言--isAbove 或 isAtMost
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=7').then(data => { assert.equal(data.assertions[3].method, 'isAtMost', '1 - Math.random() is > 0 and <= 1. It is atMost 1 !'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
|
||||
```
|
||||
@ -42,6 +47,11 @@ tests:
|
||||
<section id='solution'>
|
||||
|
||||
```js
|
||||
// solution required
|
||||
/**
|
||||
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>
|
||||
|
@ -2,15 +2,20 @@
|
||||
id: 587d824a367417b2b2512c46
|
||||
title: Learn How JavaScript Assertions Work
|
||||
challengeType: 2
|
||||
videoUrl: ''
|
||||
localeTitle: 了解JavaScript断言的工作原理
|
||||
isHidden: false
|
||||
forumTopicId: 301589
|
||||
localeTitle: 了解 JavaScript 断言是如何工作的
|
||||
---
|
||||
|
||||
## Description
|
||||
<section id="description">提醒一下,这个项目是基于<a href="https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-mochachai/">Glitch</a>的以下入门项目构建的,或者是从<a href="https://github.com/freeCodeCamp/boilerplate-mochachai/">GitHub</a>克隆的。使用assert.isNull()或assert.isNotNull()来使测试通过。 </section>
|
||||
<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> 上克隆。
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
<section id="instructions">
|
||||
<section id='instructions'>
|
||||
使用 assert.isNull() 或 assert.isNotNull() 通过测试。
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
@ -18,11 +23,11 @@ localeTitle: 了解JavaScript断言的工作原理
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: 所有测试都应该通过
|
||||
- text: 需通过全部测试
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=0').then(data => {assert.equal(data.state,'passed'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
- text: 选择正确的断言 - isNull vs. isNotNull
|
||||
- text: 请选择正确的断言--isNull 或 isNotNull
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=0').then(data => { assert.equal(data.assertions[0].method, 'isNull', 'Null is null'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
- text: 选择正确的断言 - isNull vs. isNotNull
|
||||
- text: 请选择正确的断言--isNull 或 isNotNull
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=0').then(data => { assert.equal(data.assertions[1].method, 'isNotNull', '1 is not null'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
|
||||
```
|
||||
@ -38,6 +43,11 @@ tests:
|
||||
<section id='solution'>
|
||||
|
||||
```js
|
||||
// solution required
|
||||
/**
|
||||
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>
|
||||
|
@ -2,15 +2,49 @@
|
||||
id: 587d824f367417b2b2512c5a
|
||||
title: Run Functional Tests on an API Response using Chai-HTTP III - PUT method
|
||||
challengeType: 2
|
||||
videoUrl: ''
|
||||
localeTitle: 使用Chai-HTTP III-PUT方法在API响应上运行功能测试
|
||||
isHidden: false
|
||||
forumTopicId: 301590
|
||||
localeTitle: 使用 Chai-HTTP III 的 PUT 方法运行功能测试
|
||||
---
|
||||
|
||||
## Description
|
||||
<section id="description">提醒一下,这个项目是基于<a href="https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-mochachai/">Glitch</a>的以下入门项目构建的,或者是从<a href="https://github.com/freeCodeCamp/boilerplate-mochachai/">GitHub</a>克隆的。在下一个示例中,我们将看到如何在请求有效负载(正文)中发送数据。我们将测试PUT请求。 '/ travelers'端点接受一个采用结构的JSON对象:{surname:[过去的旅行者的姓氏]},路由响应:{name:[first name],surname:[last name],dates :[birth - death years]}查看服务器代码以获取更多详细信息。发送{姓:'科伦坡'}。替换assert.fail()并使测试通过。检查1)状态,2)类型,3)body.name,4)body.surname遵循上面的断言顺序,我们依赖它。 </section>
|
||||
<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> 上克隆。
|
||||
下一个例子我们将了解如何使用 request payload(body)发送数据。
|
||||
我们准备测试发送到 '/travellers' 端点的 PUT 请求
|
||||
JSON 对象结构如下:
|
||||
|
||||
```json
|
||||
{
|
||||
"surname": [last name of a traveller of the past]
|
||||
}
|
||||
```
|
||||
|
||||
route 相应如下:
|
||||
|
||||
```json
|
||||
{
|
||||
"name": [first name], "surname": [last name], "dates": [birth - death years]
|
||||
}
|
||||
```
|
||||
|
||||
更多细节请查看服务器代码。
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
<section id="instructions">
|
||||
<section id='instructions'>
|
||||
发送 <br>
|
||||
|
||||
```json
|
||||
{
|
||||
"surname": "Colombo"
|
||||
}
|
||||
```
|
||||
|
||||
替换 assert.fail(),使测试通过。
|
||||
测试 1) status, 2) type, 3) body.name, 4) body.surname
|
||||
请按照以上顺序书写断言,顺序错误会影响系统判定。
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
@ -18,15 +52,15 @@ localeTitle: 使用Chai-HTTP III-PUT方法在API响应上运行功能测试
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: 所有测试都应该通过
|
||||
- text: 需通过全部测试
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=functional&n=2').then(data => { assert.equal(data.state,'passed'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
- text: 您应该测试'res.status'为200
|
||||
- text: '你需要测试 "res.status" 是否为 200'
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=functional&n=2').then(data => { assert.equal(data.assertions[0].method, 'equal'); assert.equal(data.assertions[0].args[0], 'res.status'); assert.equal(data.assertions[0].args[1], '200');}, xhr => { throw new Error(xhr.responseText); })
|
||||
- text: 你应该测试'res.type'是'application / json'
|
||||
- text: '你需要测试 "res.type" 是否为 "application/json"'
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=functional&n=2').then(data => { assert.equal(data.assertions[1].method, 'equal'); assert.equal(data.assertions[1].args[0], 'res.type'); assert.equal(data.assertions[1].args[1], '\'application/json\'');}, xhr => { throw new Error(xhr.responseText); })
|
||||
- text: 您应该测试'res.body.name'为'Cristoforo'
|
||||
- text: '你需要测试 "res.body.name" 是否为 "Cristoforo"'
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=functional&n=2').then(data => { assert.equal(data.assertions[2].method, 'equal'); assert.equal(data.assertions[2].args[0], 'res.body.name'); assert.equal(data.assertions[2].args[1], '\'Cristoforo\'');}, xhr => { throw new Error(xhr.responseText); })
|
||||
- text: 你应该测试'res.body.surname'是'科伦坡'
|
||||
- text: '你需要测试 "res.body.surname" 是否为 "Colombo"'
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=functional&n=2').then(data => { assert.equal(data.assertions[3].method, 'equal'); assert.equal(data.assertions[3].args[0], 'res.body.surname'); assert.equal(data.assertions[3].args[1], '\'Colombo\'');}, xhr => { throw new Error(xhr.responseText); })
|
||||
|
||||
```
|
||||
@ -42,6 +76,11 @@ tests:
|
||||
<section id='solution'>
|
||||
|
||||
```js
|
||||
// solution required
|
||||
/**
|
||||
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>
|
||||
|
@ -2,15 +2,31 @@
|
||||
id: 587d824f367417b2b2512c5b
|
||||
title: Run Functional Tests on an API Response using Chai-HTTP IV - PUT method
|
||||
challengeType: 2
|
||||
videoUrl: ''
|
||||
localeTitle: 使用Chai-HTTP IV - PUT方法在API响应上运行功能测试
|
||||
isHidden: false
|
||||
forumTopicId: 301591
|
||||
localeTitle: 使用 Chai-HTTP IV 的 PUT 方法运行功能测试
|
||||
---
|
||||
|
||||
## Description
|
||||
<section id="description">提醒一下,这个项目是基于<a href="https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-mochachai/">Glitch</a>的以下入门项目构建的,或者是从<a href="https://github.com/freeCodeCamp/boilerplate-mochachai/">GitHub</a>克隆的。此练习与前面的练习类似。看看它的细节。发送{姓:'da Verrazzano'}。替换assert.fail()并使测试通过。检查1)状态,2)类型,3)body.name,4)body.surname遵循上面的断言顺序,我们依赖它。 </section>
|
||||
<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> 上克隆。
|
||||
这个练习与上一个类似,我们详细看看。
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
<section id="instructions">
|
||||
<section id='instructions'>
|
||||
发送
|
||||
|
||||
```json
|
||||
{
|
||||
"surname": "da Verrazzano"
|
||||
}
|
||||
```
|
||||
|
||||
替换 assert.fail(),使测试通过。
|
||||
测试 for 1) status, 2) type, 3) body.name, 4) body.surname
|
||||
请按照以上顺序书写断言,顺序错误会影响系统判定。
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
@ -18,15 +34,15 @@ localeTitle: 使用Chai-HTTP IV - PUT方法在API响应上运行功能测试
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: 所有测试都应该通过
|
||||
- text: 需通过全部测试
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=functional&n=3').then(data => { assert.equal(data.state,'passed'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
- text: 您应该测试'res.status'为200
|
||||
- text: '你需要测试 "res.status" 是否为 200'
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=functional&n=3').then(data => { assert.equal(data.assertions[0].method, 'equal'); assert.equal(data.assertions[0].args[0], 'res.status'); assert.equal(data.assertions[0].args[1], '200');}, xhr => { throw new Error(xhr.responseText); })
|
||||
- text: 你应该测试'res.type'是'application / json'
|
||||
- text: '你需要测试 "res.type" 是否为 "application/json"'
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=functional&n=3').then(data => { assert.equal(data.assertions[1].method, 'equal'); assert.equal(data.assertions[1].args[0], 'res.type'); assert.equal(data.assertions[1].args[1], '\'application/json\'');}, xhr => { throw new Error(xhr.responseText); })
|
||||
- text: 您应该测试'res.body.name'为'Giovanni'
|
||||
- text: '你需要测试 "res.body.name" 是否为 "Giovanni"'
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=functional&n=3').then(data => { assert.equal(data.assertions[2].method, 'equal'); assert.equal(data.assertions[2].args[0], 'res.body.name'); assert.equal(data.assertions[2].args[1], '\'Giovanni\'');}, xhr => { throw new Error(xhr.responseText); })
|
||||
- text: 你应该测试'res.body.surname'是'da Verrazzano'
|
||||
- text: '你需要测试 "res.body.surname" 是否为 "da Verrazzano"'
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=functional&n=3').then(data => { assert.equal(data.assertions[3].method, 'equal'); assert.equal(data.assertions[3].args[0], 'res.body.surname'); assert.equal(data.assertions[3].args[1], '\'da Verrazzano\'');}, xhr => { throw new Error(xhr.responseText); })
|
||||
|
||||
```
|
||||
@ -42,6 +58,11 @@ tests:
|
||||
<section id='solution'>
|
||||
|
||||
```js
|
||||
// solution required
|
||||
/**
|
||||
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>
|
||||
|
@ -2,15 +2,21 @@
|
||||
id: 587d824f367417b2b2512c59
|
||||
title: Run Functional Tests on API Endpoints using Chai-HTTP II
|
||||
challengeType: 2
|
||||
videoUrl: ''
|
||||
localeTitle: 使用Chai-HTTP II在API端点上运行功能测试
|
||||
isHidden: false
|
||||
forumTopicId: 301592
|
||||
localeTitle: 使用 Chai-HTTP II 在 API 端上运行功能测试
|
||||
---
|
||||
|
||||
## Description
|
||||
<section id="description">提醒一下,这个项目是基于<a href="https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-mochachai/">Glitch</a>的以下入门项目构建的,或者是从<a href="https://github.com/freeCodeCamp/boilerplate-mochachai/">GitHub</a>克隆的。替换assert.fail()。测试状态和text.response。让测试通过。在追加的查询中发送您的姓名吗?name = <your_name> ,端点以'你好'回应<your_name> ”。 </your_name></your_name></section>
|
||||
<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> 上克隆。
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
<section id="instructions">
|
||||
<section id='instructions'>
|
||||
替换 assert.fail()。测试 status 和 text.response,使测试通过。
|
||||
在 query 中传入你的名字 ?name=<your_name>,端点会返回 'hello <your_name>'。
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
@ -18,11 +24,11 @@ localeTitle: 使用Chai-HTTP II在API端点上运行功能测试
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: 所有测试都应该通过
|
||||
- text: 需通过全部测试
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=functional&n=1').then(data => { assert.equal(data.state,'passed'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
- text: 你应该测试'res.status'== 200
|
||||
- text: '你需要测试 "res.status" == 200'
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=functional&n=1').then(data => { assert.equal(data.assertions[0].method, 'equal'); assert.equal(data.assertions[0].args[0], 'res.status'); assert.equal(data.assertions[0].args[1], '200');}, xhr => { throw new Error(xhr.responseText); })
|
||||
- text: 你应该测试'res.text'=='你好客人'
|
||||
- text: '你需要测试 "res.text" == "hello Guest"'
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=functional&n=1').then(data => { assert.equal(data.assertions[1].method, 'equal'); assert.equal(data.assertions[1].args[0], 'res.text'); assert.match(data.assertions[1].args[1], /hello [\w\d_-]/);}, xhr => { throw new Error(xhr.responseText); })
|
||||
|
||||
```
|
||||
@ -38,6 +44,11 @@ tests:
|
||||
<section id='solution'>
|
||||
|
||||
```js
|
||||
// solution required
|
||||
/**
|
||||
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>
|
||||
|
@ -2,15 +2,21 @@
|
||||
id: 587d824e367417b2b2512c58
|
||||
title: Run Functional Tests on API Endpoints using Chai-HTTP
|
||||
challengeType: 2
|
||||
videoUrl: ''
|
||||
localeTitle: 使用Chai-HTTP在API端点上运行功能测试
|
||||
isHidden: false
|
||||
forumTopicId: 301593
|
||||
localeTitle: 使用 Chai-HTTP 在 API 端上运行功能测试
|
||||
---
|
||||
|
||||
## Description
|
||||
<section id="description">提醒一下,这个项目是基于<a href="https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-mochachai/">Glitch</a>的以下入门项目构建的,或者是从<a href="https://github.com/freeCodeCamp/boilerplate-mochachai/">GitHub</a>克隆的。替换assert.fail()。测试状态和text.response。让测试通过。不要在查询中发送名称,端点会以“hello Guest”响应。 </section>
|
||||
<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> 上克隆。
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
<section id="instructions">
|
||||
<section id='instructions'>
|
||||
替换 assert.fail()。测试 status 和 text.response,使测试通过。
|
||||
不要在 query 中传入 name,端点将会返回 'hello Guest'.
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
@ -18,11 +24,11 @@ localeTitle: 使用Chai-HTTP在API端点上运行功能测试
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: 所有测试都应该通过
|
||||
- text: 需通过全部测试
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=functional&n=0').then(data => { assert.equal(data.state,'passed'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
- text: 你应该测试'res.status'== 200
|
||||
- text: '你需要测试 "res.status" == 200'
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=functional&n=0').then(data => { assert.equal(data.assertions[0].method, 'equal'); assert.equal(data.assertions[0].args[0], 'res.status'); assert.equal(data.assertions[0].args[1], '200');}, xhr => { throw new Error(xhr.responseText); })
|
||||
- text: 你应该测试'res.text'=='你好客人'
|
||||
- text: '你需要测试 "res.text" == "hello Guest"'
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=functional&n=0').then(data => { assert.equal(data.assertions[1].method, 'equal'); assert.equal(data.assertions[1].args[0], 'res.text'); assert.equal(data.assertions[1].args[1], '\'hello Guest\'');}, xhr => { throw new Error(xhr.responseText); })
|
||||
|
||||
```
|
||||
@ -38,6 +44,11 @@ tests:
|
||||
<section id='solution'>
|
||||
|
||||
```js
|
||||
// solution required
|
||||
/**
|
||||
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>
|
||||
|
@ -2,15 +2,21 @@
|
||||
id: 587d8250367417b2b2512c5d
|
||||
title: Run Functional Tests using a Headless Browser II
|
||||
challengeType: 2
|
||||
videoUrl: ''
|
||||
localeTitle: 使用无头浏览器II运行功能测试
|
||||
isHidden: false
|
||||
forumTopicId: 301594
|
||||
localeTitle: 使用 无头浏览器 II 运行功能测试
|
||||
---
|
||||
|
||||
## Description
|
||||
<section id="description">提醒一下,这个项目是基于<a href="https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-mochachai/">Glitch</a>的以下入门项目构建的,或者是从<a href="https://github.com/freeCodeCamp/boilerplate-mochachai/">GitHub</a>克隆的。此练习与前面的练习类似。查看方向代码。按照断言顺序,我们依靠它。 </section>
|
||||
<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> 上克隆。
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
<section id="instructions">
|
||||
<section id='instructions'>
|
||||
这个练习与上一个类似。
|
||||
看看此挑战的给出的代码指引。请按顺序书写断言,顺序错误会影响系统判定。
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
@ -18,15 +24,15 @@ localeTitle: 使用无头浏览器II运行功能测试
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: 所有测试都应该通过
|
||||
- text: 需通过全部测试
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=functional&n=5').then(data => { assert.equal(data.state,'passed'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
- text: 断言无头浏览器请求成功
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=functional&n=5').then(data => { assert.equal(data.assertions[0].method, 'browser.success'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
- text: 断言元素“span#name”中的文本是“Amerigo”
|
||||
- text: '断言 "span#name" 元素里的文字为 "Amerigo"'
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=functional&n=5').then(data => { assert.equal(data.assertions[1].method, 'browser.text'); assert.equal(data.assertions[1].args[0], '\'span#name\''); assert.equal(data.assertions[1].args[1], '\'Amerigo\'');}, xhr => { throw new Error(xhr.responseText); })
|
||||
- text: 断言元素“span#surname”中的文本是“Vespucci”
|
||||
- text: '断言 "span#surname" 元素里的文字为 "Vespucci"'
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=functional&n=5').then(data => { assert.equal(data.assertions[2].method, 'browser.text'); assert.equal(data.assertions[2].args[0], '\'span#surname\''); assert.equal(data.assertions[2].args[1], '\'Vespucci\'');}, xhr => { throw new Error(xhr.responseText); })
|
||||
- text: '断言元素“span #dalendar”存在且其计数为1'
|
||||
- text: '断言 "span#dates" 的存在,并且计数为 1'
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=functional&n=5').then(data => { assert.equal(data.assertions[3].method, 'browser.element'); assert.equal(data.assertions[3].args[0], '\'span#dates\''); assert.equal(data.assertions[3].args[1], 1);}, xhr => { throw new Error(xhr.responseText); })
|
||||
|
||||
```
|
||||
@ -42,6 +48,11 @@ tests:
|
||||
<section id='solution'>
|
||||
|
||||
```js
|
||||
// solution required
|
||||
/**
|
||||
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>
|
||||
|
@ -2,15 +2,23 @@
|
||||
id: 587d824f367417b2b2512c5c
|
||||
title: Run Functional Tests using a Headless Browser
|
||||
challengeType: 2
|
||||
videoUrl: ''
|
||||
localeTitle: 使用无头浏览器运行功能测试
|
||||
isHidden: false
|
||||
forumTopicId: 301595
|
||||
localeTitle: 使用 无头浏览器 运行功能测试
|
||||
---
|
||||
|
||||
## Description
|
||||
<section id="description">提醒一下,这个项目是基于<a href="https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-mochachai/">Glitch</a>的以下入门项目构建的,或者是从<a href="https://github.com/freeCodeCamp/boilerplate-mochachai/">GitHub</a>克隆的。在接下来的挑战中,我们将使用名为“Headless Browser”的设备模拟人与页面的交互。无头浏览器是没有图形用户界面的Web浏览器。这些工具对于测试网页特别有用,因为它们能够以与浏览器相同的方式呈现和理解HTML,CSS和JavaScript。对于这些挑战,我们使用的是Zombie.JS。它是一个完全基于JS的轻量级浏览器,不依赖于安装其他二进制文件。此功能使其可用于Glitch等环境。还有许多其他(更强大的)选项。 <br>查看练习方向代码中的示例按照断言顺序,我们依赖它。 </section>
|
||||
<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> 上克隆。
|
||||
下一项挑战,我们将会使用无头浏览器模拟人机交互。
|
||||
无头浏览器是一种没有图形用户界面的浏览器。这类工具对网页调试特别有效,因为它们可以跟普通浏览器一样理解和渲染 HTML,CSS 和 JavaScript。
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
<section id="instructions">
|
||||
<section id='instructions'>
|
||||
这次挑战我们使用 Zombie.JS。它是一款完全基于 JS 的轻量级浏览器,不需要安装其他二进制文件。这个特性使它可以轻松在如 Glitch 的环境下使用。还有很多(更强大的)选项。<br>
|
||||
看看此挑战的给出的代码指引。请按顺序书写断言,顺序错误会影响系统判定。
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
@ -18,15 +26,15 @@ localeTitle: 使用无头浏览器运行功能测试
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: 所有测试都应该通过
|
||||
- text: 需通过全部测试
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=functional&n=4').then(data => { assert.equal(data.state,'passed'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
- text: 断言无头浏览器请求成功
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=functional&n=4').then(data => { assert.equal(data.assertions[0].method, 'browser.success'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
- text: 断言元素“span#name”中的文本是“Cristoforo”
|
||||
- text: '断言 "span#name" 元素里的文字为 "Cristoforo"'
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=functional&n=4').then(data => { assert.equal(data.assertions[1].method, 'browser.text'); assert.equal(data.assertions[1].args[0], '\'span#name\''); assert.equal(data.assertions[1].args[1], '\'Cristoforo\'');}, xhr => { throw new Error(xhr.responseText); })
|
||||
- text: 断言元素“span#surname”中的文本是“Colombo”
|
||||
- text: '断言 "span#surname" 元素里的文字为 "Colombo"'
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=functional&n=4').then(data => { assert.equal(data.assertions[2].method, 'browser.text'); assert.equal(data.assertions[2].args[0], '\'span#surname\''); assert.equal(data.assertions[2].args[1], '\'Colombo\'');}, xhr => { throw new Error(xhr.responseText); })
|
||||
- text: '断言元素“span #dalendar”存在且其计数为1'
|
||||
- text: '断言 "span#dates" 的存在,并且计数为 1'
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=functional&n=4').then(data => { assert.equal(data.assertions[3].method, 'browser.element'); assert.equal(data.assertions[3].args[0], '\'span#dates\''); assert.equal(data.assertions[3].args[1], 1);}, xhr => { throw new Error(xhr.responseText); })
|
||||
|
||||
```
|
||||
@ -42,6 +50,11 @@ tests:
|
||||
<section id='solution'>
|
||||
|
||||
```js
|
||||
// solution required
|
||||
/**
|
||||
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>
|
||||
|
@ -2,15 +2,29 @@
|
||||
id: 587d824b367417b2b2512c49
|
||||
title: Test for Truthiness
|
||||
challengeType: 2
|
||||
videoUrl: ''
|
||||
localeTitle: 测试真实性
|
||||
isHidden: false
|
||||
forumTopicId: 301596
|
||||
localeTitle: 真假测试
|
||||
---
|
||||
|
||||
## Description
|
||||
<section id="description">提醒一下,这个项目是基于<a href="https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-mochachai/">Glitch</a>的以下入门项目构建的,或者是从<a href="https://github.com/freeCodeCamp/boilerplate-mochachai/">GitHub</a>克隆的。使用assert.isTrue()或assert.isNotTrue()来使测试通过。 .isTrue(true)和.isNotTrue(其他所有内容)都将通过。 .isFalse()和.isNotFalse()也存在。 </section>
|
||||
<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> 上克隆。
|
||||
|
||||
.isTrue(true) 和 .isNotTrue(everything else) 可以通过测试。
|
||||
|
||||
```js
|
||||
assert.isTrue(true, 'this will pass with the boolean value true');
|
||||
assert.isTrue('true', 'this will NOT pass with the string value 'true');
|
||||
assert.isTrue(1, 'this will NOT pass with the number value 1');
|
||||
```
|
||||
|
||||
.isFalse() 和 .isNotFalse() 断言同样存在。
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
<section id="instructions">
|
||||
<section id='instructions'>
|
||||
使用 assert.isTrue() 或 assert.isNotTrue() 通过测试。
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
@ -18,13 +32,13 @@ localeTitle: 测试真实性
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: 所有测试都应该通过
|
||||
- text: 需通过全部测试
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=3').then(data => {assert.equal(data.state,'passed'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
- text: 选择正确的断言 - isTrue vs. isNotTrue
|
||||
- text: 请选择正确的断言--isTrue 或 isNotTrue
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=3').then(data => { assert.equal(data.assertions[0].method, 'isTrue', 'True is true'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
- text: 选择正确的断言 - isTrue vs. isNotTrue
|
||||
- text: 请选择正确的断言--isTrue 或 isNotTrue
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=3').then(data => { assert.equal(data.assertions[1].method, 'isTrue', 'Double negation of a truthy value is true'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
- text: 选择正确的断言 - isTrue vs. isNotTrue
|
||||
- text: 请选择正确的断言--isTrue 或 isNotTrue
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=3').then(data => { assert.equal(data.assertions[2].method, 'isNotTrue', 'A truthy object is not true - neither is a false one'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
|
||||
```
|
||||
@ -40,6 +54,11 @@ tests:
|
||||
<section id='solution'>
|
||||
|
||||
```js
|
||||
// solution required
|
||||
/**
|
||||
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>
|
||||
|
@ -2,15 +2,24 @@
|
||||
id: 587d824d367417b2b2512c53
|
||||
title: Test if a String Contains a Substring
|
||||
challengeType: 2
|
||||
videoUrl: ''
|
||||
localeTitle: 测试String是否包含子串
|
||||
isHidden: false
|
||||
forumTopicId: 301597
|
||||
localeTitle: 测试字符串是否包含子字符串
|
||||
---
|
||||
|
||||
## Description
|
||||
<section id="description">提醒一下,这个项目是基于<a href="https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-mochachai/">Glitch</a>的以下入门项目构建的,或者是从<a href="https://github.com/freeCodeCamp/boilerplate-mochachai/">GitHub</a>克隆的。 #include(在#notInclude上)也适用于字符串!!它断言实际的字符串包含预期的子字符串</section>
|
||||
<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> 上克隆。
|
||||
|
||||
#include(相对于 #notInclude)也可用于字符串!
|
||||
它断言字符串包含某个子串
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
<section id="instructions">
|
||||
<section id='instructions'>
|
||||
使用 <code>assert.include()</code> 或者 <code>assert.notInclude()</code> 通过测试。
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
@ -18,11 +27,11 @@ localeTitle: 测试String是否包含子串
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: 所有测试都应该通过
|
||||
- text: 需通过全部测试
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=13').then(data => { assert.equal(data.state,'passed'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
- text: 选择正确的断言 - include与notInclude
|
||||
- text: 请选择正确的断言--include 或 notInclude
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=13').then(data => { assert.equal(data.assertions[0].method, 'include', '\'Arrow\' contains \'row\'...'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
- text: 选择正确的断言 - include与notInclude
|
||||
- text: 请选择正确的断言--include 或 notInclude
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=13').then(data => { assert.equal(data.assertions[1].method, 'notInclude', '... a \'dart\' doesn\'t contain a \'queue\''); }, xhr => { throw new Error(xhr.responseText); })
|
||||
|
||||
```
|
||||
@ -38,6 +47,11 @@ tests:
|
||||
<section id='solution'>
|
||||
|
||||
```js
|
||||
// solution required
|
||||
/**
|
||||
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>
|
||||
|
@ -2,15 +2,27 @@
|
||||
id: 587d824c367417b2b2512c4f
|
||||
title: Test if a Value Falls within a Specific Range
|
||||
challengeType: 2
|
||||
videoUrl: ''
|
||||
localeTitle: 测试值是否在特定范围内
|
||||
isHidden: false
|
||||
forumTopicId: 301598
|
||||
localeTitle: 测试某个值是否在特定范围内
|
||||
---
|
||||
|
||||
## Description
|
||||
<section id="description">提醒一下,这个项目是基于<a href="https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-mochachai/">Glitch</a>的以下入门项目构建的,或者是从<a href="https://github.com/freeCodeCamp/boilerplate-mochachai/">GitHub</a>克隆的。 。近似。(实际,预期,范围,[消息])实际=预期+/-范围选择最小范围(第3个参数)使测试始终通过它应小于1 </section>
|
||||
<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> 上克隆。
|
||||
|
||||
<code>.approximately(actual, expected, delta, [message])</code>
|
||||
断言在 +/- <code>delta</code> 范围内实际和 <code>expected</code> 相等。
|
||||
|
||||
actual = expected +/- range
|
||||
填写最小的 range(第三个参数)使测试总是通过
|
||||
该值应小于 1
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
<section id="instructions">
|
||||
<section id='instructions'>
|
||||
使用 <code>assert.approximately()</code> 来通过测试。
|
||||
选择最小范围(第三个参数)来通过所有测试。它应该小于 1。
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
@ -18,11 +30,11 @@ localeTitle: 测试值是否在特定范围内
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: 所有测试都应该通过
|
||||
- text: 需通过全部测试
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=9').then(data => {assert.equal(data.state,'passed'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
- text: 使用大约(实际,预期,范围) - 选择正确的范围
|
||||
- text: Use approximately(actual, expected, range) - Chose the correct range
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=9').then(data => { assert.equal(data.assertions[0].method, 'approximately'); assert.equal(data.assertions[0].args[2], 0.5, 'weirdNumbers(0.5) is in the range (0.5, 1.5]. It\'s within 1 +/- 0.5'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
- text: 使用大约(实际,预期,范围) - 选择正确的范围
|
||||
- text: Use approximately(actual, expected, range) - Chose the correct range
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=9').then(data => { assert.equal(data.assertions[1].method, 'approximately'); assert.equal(data.assertions[1].args[2], 0.8, 'weirdNumbers(0.2) is in the range (0.2, 1.2]. It\'s within 1 +/- 0.8'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
|
||||
```
|
||||
@ -38,6 +50,11 @@ tests:
|
||||
<section id='solution'>
|
||||
|
||||
```js
|
||||
// solution required
|
||||
/**
|
||||
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>
|
||||
|
@ -2,15 +2,20 @@
|
||||
id: 587d824d367417b2b2512c52
|
||||
title: Test if a Value is a String
|
||||
challengeType: 2
|
||||
videoUrl: ''
|
||||
localeTitle: 测试值是否为字符串
|
||||
isHidden: false
|
||||
forumTopicId: 301599
|
||||
localeTitle: 测试某个值是否为字符串
|
||||
---
|
||||
|
||||
## Description
|
||||
<section id="description">提醒一下,这个项目是基于<a href="https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-mochachai/">Glitch</a>的以下入门项目构建的,或者是从<a href="https://github.com/freeCodeCamp/boilerplate-mochachai/">GitHub</a>克隆的。 #isString断言实际值是一个字符串。 </section>
|
||||
<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> 上克隆。
|
||||
#isString 断言一个值为字符串。
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
<section id="instructions">
|
||||
<section id='instructions'>
|
||||
使用 <code>assert.isString()</code> 或者 <code>assert.isNotString()</code> 通过所有测试。
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
@ -18,13 +23,13 @@ localeTitle: 测试值是否为字符串
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: 所有测试都应该通过
|
||||
- text: 需通过全部测试
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=12').then(data => { assert.equal(data.state,'passed'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
- text: 选择正确的断言 - isString vs. isNotString
|
||||
- text: 请选择正确的断言--isString 或 isNotString
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=12').then(data => { assert.equal(data.assertions[0].method, 'isNotString', 'A float number is not a string'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
- text: 选择正确的断言 - isString vs. isNotString
|
||||
- text: 请选择正确的断言--isString 或 isNotString
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=12').then(data => { assert.equal(data.assertions[1].method, 'isString', 'environment vars are strings (or undefined)'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
- text: 选择正确的断言 - isString vs. isNotString
|
||||
- text: 请选择正确的断言--isString 或 isNotString
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=12').then(data => { assert.equal(data.assertions[2].method, 'isString', 'A JSON is a string'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
|
||||
```
|
||||
@ -40,6 +45,11 @@ tests:
|
||||
<section id='solution'>
|
||||
|
||||
```js
|
||||
// solution required
|
||||
/**
|
||||
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>
|
||||
|
@ -2,15 +2,19 @@
|
||||
id: 587d824d367417b2b2512c50
|
||||
title: Test if a Value is an Array
|
||||
challengeType: 2
|
||||
videoUrl: ''
|
||||
localeTitle: 测试值是否为数组
|
||||
isHidden: false
|
||||
forumTopicId: 301600
|
||||
localeTitle: 测试某个值是否为数组
|
||||
---
|
||||
|
||||
## Description
|
||||
<section id="description">提醒一下,这个项目是基于<a href="https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-mochachai/">Glitch</a>的以下入门项目构建的,或者是从<a href="https://github.com/freeCodeCamp/boilerplate-mochachai/">GitHub</a>克隆的。 </section>
|
||||
<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> 上克隆。
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
<section id="instructions">
|
||||
<section id='instructions'>
|
||||
使用 <code>assert.isArray()</code> 或者 <code>assert.isNotArray()</code> 通过所有测试。
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
@ -18,11 +22,11 @@ localeTitle: 测试值是否为数组
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: 所有测试都应该通过
|
||||
- text: 需通过全部测试
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=10').then(data => {assert.equal(data.state,'passed'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
- text: 选择正确的断言 - isArray vs. isNotArray
|
||||
- text: 请选择正确的断言--isArray 或 isNotArray
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=10').then(data => { assert.equal(data.assertions[0].method, 'isArray', 'String.prototype.split() returns an Array'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
- text: 选择正确的断言 - isArray vs. isNotArray
|
||||
- text: 请选择正确的断言--isArray 或 isNotArray
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=10').then(data => { assert.equal(data.assertions[1].method, 'isNotArray', 'Array.prototype.indexOf() returns a number'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
|
||||
```
|
||||
@ -38,6 +42,11 @@ tests:
|
||||
<section id='solution'>
|
||||
|
||||
```js
|
||||
// solution required
|
||||
/**
|
||||
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>
|
||||
|
@ -2,15 +2,20 @@
|
||||
id: 587d824e367417b2b2512c56
|
||||
title: Test if a Value is of a Specific Data Structure Type
|
||||
challengeType: 2
|
||||
videoUrl: ''
|
||||
localeTitle: 测试值是否为特定数据结构类型
|
||||
isHidden: false
|
||||
forumTopicId: 301601
|
||||
localeTitle: 测试某个值是否是特定的数据类型
|
||||
---
|
||||
|
||||
## Description
|
||||
<section id="description">提醒一下,这个项目是基于<a href="https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-mochachai/">Glitch</a>的以下入门项目构建的,或者是从<a href="https://github.com/freeCodeCamp/boilerplate-mochachai/">GitHub</a>克隆的。 #typeOf断言值的类型是给定的字符串,由Object.prototype.toString确定。在适当的地方使用#typeOf或#notTypeOf </section>
|
||||
<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> 上克隆。
|
||||
#typeOf 断言一个值的类型是给定字符串,这个字符串由 Object.prototype.toString 决定。
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
<section id="instructions">
|
||||
<section id='instructions'>
|
||||
使用 <code>assert.typeOf()</code> 或者 <code>assert.notTypeOf()</code> 来通过所有测试。
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
@ -18,17 +23,17 @@ localeTitle: 测试值是否为特定数据结构类型
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: 所有测试都应该通过
|
||||
- text: 需通过全部测试
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=16').then(data => { assert.equal(data.state,'passed'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
- text: 选择正确的断言 - typeOf vs. notTypeOf
|
||||
- text: 请选择正确的断言--typeOf 或 notTypeOf
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=16').then(data => { assert.equal(data.assertions[0].method, 'typeOf', 'myCar is typeOf Object'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
- text: 选择正确的断言 - typeOf vs. notTypeOf
|
||||
- text: 请选择正确的断言--typeOf 或 notTypeOf
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=16').then(data => { assert.equal(data.assertions[1].method, 'typeOf', 'Car.model is a String'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
- text: 选择正确的断言 - typeOf vs. notTypeOf
|
||||
- text: 请选择正确的断言--typeOf 或 notTypeOf
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=16').then(data => { assert.equal(data.assertions[2].method, 'notTypeOf', 'Plane.wings is a Number (not a String)'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
- text: 选择正确的断言 - typeOf vs. notTypeOf
|
||||
- text: 请选择正确的断言--typeOf 或 notTypeOf
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=16').then(data => { assert.equal(data.assertions[3].method, 'typeOf', 'Plane.engines is an Array'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
- text: 选择正确的断言 - typeOf vs. notTypeOf
|
||||
- text: 请选择正确的断言--typeOf 或 notTypeOf
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=16').then(data => { assert.equal(data.assertions[4].method, 'typeOf', 'Car.wheels is a Number'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
|
||||
```
|
||||
@ -44,6 +49,11 @@ tests:
|
||||
<section id='solution'>
|
||||
|
||||
```js
|
||||
// solution required
|
||||
/**
|
||||
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>
|
||||
|
@ -2,15 +2,20 @@
|
||||
id: 587d824b367417b2b2512c47
|
||||
title: Test if a Variable or Function is Defined
|
||||
challengeType: 2
|
||||
videoUrl: ''
|
||||
localeTitle: 测试变量或函数是否定义
|
||||
isHidden: false
|
||||
forumTopicId: 301602
|
||||
localeTitle: 测试变量或函数是否已定义
|
||||
---
|
||||
|
||||
## Description
|
||||
<section id="description">提醒一下,这个项目是基于<a href="https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-mochachai/">Glitch</a>的以下入门项目构建的,或者是从<a href="https://github.com/freeCodeCamp/boilerplate-mochachai/">GitHub</a>克隆的。使用assert.isDefined()或assert.isUndefined()来使测试通过</section>
|
||||
<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> 上克隆。
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
<section id="instructions">
|
||||
<section id='instructions'>
|
||||
使用 assert.isDefined() 或 assert.isUndefined() 通过测试。
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
@ -18,13 +23,13 @@ localeTitle: 测试变量或函数是否定义
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: 所有测试都应该通过
|
||||
- text: 需通过全部测试
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=1').then(data => {assert.equal(data.state,'passed'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
- text: 选择正确的断言 - isDefined与isUndefined
|
||||
- text: 请选择正确的断言--isDefined 或 isUndefined
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=1').then(data => { assert.equal(data.assertions[0].method, 'isDefined', 'Null is not undefined'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
- text: 选择正确的断言 - isDefined与isUndefined
|
||||
- text: 请选择正确的断言--isDefined 或 isUndefined
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=1').then(data => { assert.equal(data.assertions[1].method, 'isUndefined', 'Undefined is undefined'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
- text: 选择正确的断言 - isDefined与isUndefined
|
||||
- text: 请选择正确的断言--isDefined 或 isUndefined
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=1').then(data => { assert.equal(data.assertions[2].method, 'isDefined', 'A string is not undefined'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
|
||||
```
|
||||
@ -40,6 +45,11 @@ tests:
|
||||
<section id='solution'>
|
||||
|
||||
```js
|
||||
// solution required
|
||||
/**
|
||||
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>
|
||||
|
@ -2,15 +2,19 @@
|
||||
id: 587d824d367417b2b2512c51
|
||||
title: Test if an Array Contains an Item
|
||||
challengeType: 2
|
||||
videoUrl: ''
|
||||
localeTitle: 测试数组是否包含项目
|
||||
isHidden: false
|
||||
forumTopicId: 301603
|
||||
localeTitle: 测试数组是否包含某个项目
|
||||
---
|
||||
|
||||
## Description
|
||||
<section id="description">提醒一下,这个项目是基于<a href="https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-mochachai/">Glitch</a>的以下入门项目构建的,或者是从<a href="https://github.com/freeCodeCamp/boilerplate-mochachai/">GitHub</a>克隆的。 </section>
|
||||
<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> 上克隆。
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
<section id="instructions">
|
||||
<section id='instructions'>
|
||||
使用 <code>assert.include()</code> 或者 <code>assert.notInclude()</code> 来通过所有测试。
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
@ -18,11 +22,11 @@ localeTitle: 测试数组是否包含项目
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: 所有测试都应该通过
|
||||
- text: 需通过全部测试
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=11').then(data => { assert.equal(data.state,'passed'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
- text: 选择正确的断言 - include与notInclude
|
||||
- text: 请选择正确的断言--include 或 notInclude
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=11').then(data => { assert.equal(data.assertions[0].method, 'notInclude', 'It\'s summer in july...'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
- text: 选择正确的断言 - include与notInclude
|
||||
- text: 请选择正确的断言--include 或 notInclude
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=11').then(data => { assert.equal(data.assertions[1].method, 'include', 'JavaScript is a backend language !!'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
|
||||
```
|
||||
@ -38,6 +42,11 @@ tests:
|
||||
<section id='solution'>
|
||||
|
||||
```js
|
||||
// solution required
|
||||
/**
|
||||
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>
|
||||
|
@ -2,15 +2,21 @@
|
||||
id: 587d824e367417b2b2512c55
|
||||
title: Test if an Object has a Property
|
||||
challengeType: 2
|
||||
videoUrl: ''
|
||||
localeTitle: 测试对象是否具有属性
|
||||
isHidden: false
|
||||
forumTopicId: 301604
|
||||
localeTitle: 测试对象是否具有某个属性
|
||||
---
|
||||
|
||||
## Description
|
||||
<section id="description">提醒一下,这个项目是基于<a href="https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-mochachai/">Glitch</a>的以下入门项目构建的,或者是从<a href="https://github.com/freeCodeCamp/boilerplate-mochachai/">GitHub</a>克隆的。 #property断言实际对象具有给定属性。在适当的地方使用#property或#notProperty </section>
|
||||
<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> 上克隆。
|
||||
#property 断言一个对象含有给定属性。
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
<section id="instructions">
|
||||
<section id='instructions'>
|
||||
使用 <code>assert.property()</code> 或者 <code>assert.notProperty()</code> 来通过所有测试。
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
@ -18,13 +24,13 @@ localeTitle: 测试对象是否具有属性
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: 所有测试都应该通过
|
||||
- text: 需通过全部测试
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=15').then(data => { assert.equal(data.state,'passed'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
- text: 选择正确的断言 - property vs. notProperty
|
||||
- text: 请选择正确的断言--property 或 notProperty
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=15').then(data => { assert.equal(data.assertions[0].method, 'notProperty', 'A car has not wings'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
- text: 选择正确的断言 - property vs. notProperty
|
||||
- text: 请选择正确的断言--property 或 notProperty
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=15').then(data => { assert.equal(data.assertions[1].method, 'property', 'planes have engines'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
- text: 选择正确的断言 - property vs. notProperty
|
||||
- text: 请选择正确的断言--property 或 notProperty
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=15').then(data => { assert.equal(data.assertions[2].method, 'property', 'Cars have wheels'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
|
||||
```
|
||||
@ -40,6 +46,11 @@ tests:
|
||||
<section id='solution'>
|
||||
|
||||
```js
|
||||
// solution required
|
||||
/**
|
||||
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>
|
||||
|
@ -2,15 +2,21 @@
|
||||
id: 587d824e367417b2b2512c57
|
||||
title: Test if an Object is an Instance of a Constructor
|
||||
challengeType: 2
|
||||
videoUrl: ''
|
||||
isHidden: false
|
||||
forumTopicId: 301605
|
||||
localeTitle: 测试对象是否是构造函数的实例
|
||||
---
|
||||
|
||||
## Description
|
||||
<section id="description">提醒一下,这个项目是基于<a href="https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-mochachai/">Glitch</a>的以下入门项目构建的,或者是从<a href="https://github.com/freeCodeCamp/boilerplate-mochachai/">GitHub</a>克隆的。 #instanceOf声明对象是构造函数的实例。在适当的地方使用#instanceOf或#notInstanceOf </section>
|
||||
<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> 上克隆。
|
||||
#instanceOf 断言一个对象是一个构造器的实例
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
<section id="instructions">
|
||||
<section id='instructions'>
|
||||
在适当的地方使用 #instanceOf 或 #notInstanceOf
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
@ -18,15 +24,15 @@ localeTitle: 测试对象是否是构造函数的实例
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: 所有测试都应该通过
|
||||
- text: 需通过全部测试
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=17').then(data => { assert.equal(data.state,'passed'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
- text: 选择正确的断言 - instanceOf与notInstanceOf
|
||||
- text: 请选择正确的断言--instanceOf 或 notInstanceOf
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=17').then(data => { assert.equal(data.assertions[0].method, 'notInstanceOf', 'myCar is not an instance of Plane'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
- text: 选择正确的断言 - instanceOf与notInstanceOf
|
||||
- text: 请选择正确的断言--instanceOf 或 notInstanceOf
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=17').then(data => { assert.equal(data.assertions[1].method, 'instanceOf', 'airlinePlane is an instance of Plane'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
- text: 选择正确的断言 - instanceOf与notInstanceOf
|
||||
- text: 请选择正确的断言--instanceOf 或 notInstanceOf
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=17').then(data => { assert.equal(data.assertions[2].method, 'instanceOf', 'everything is an Object in JavaScript...'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
- text: 选择正确的断言 - instanceOf与notInstanceOf
|
||||
- text: 请选择正确的断言--instanceOf 或 notInstanceOf
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=17').then(data => { assert.equal(data.assertions[3].method, 'notInstanceOf', 'myCar.wheels is not an instance of String'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
|
||||
```
|
||||
@ -42,6 +48,11 @@ tests:
|
||||
<section id='solution'>
|
||||
|
||||
```js
|
||||
// solution required
|
||||
/**
|
||||
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>
|
||||
|
@ -2,15 +2,20 @@
|
||||
id: 587d824c367417b2b2512c4e
|
||||
title: Test if One Value is Below or At Least as Large as Another
|
||||
challengeType: 2
|
||||
videoUrl: ''
|
||||
localeTitle: 测试一个值是否低于或低至另一个值
|
||||
isHidden: false
|
||||
forumTopicId: 301606
|
||||
localeTitle: 测试一个值是否小于或等于另一个值
|
||||
---
|
||||
|
||||
## Description
|
||||
<section id="description">提醒一下,这个项目是基于<a href="https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-mochachai/">Glitch</a>的以下入门项目构建的,或者是从<a href="https://github.com/freeCodeCamp/boilerplate-mochachai/">GitHub</a>克隆的。 .isBelow()=> a <b,.isAtLeast => a> = b </section>
|
||||
<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> 上克隆。
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
<section id="instructions">
|
||||
<section id='instructions'>
|
||||
使用 <code>assert.isBelow()</code> (如 less than) 或者 <code>assert.isAtLeast()</code> (如 greater than or equal) 来通过所有测试。
|
||||
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
@ -18,15 +23,15 @@ localeTitle: 测试一个值是否低于或低至另一个值
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: 所有测试都应该通过
|
||||
- text: 需通过全部测试
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=8').then(data => {assert.equal(data.state,'passed'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
- text: 选择正确的断言 - isBelow vs. isAtLeast
|
||||
- text: 请选择正确的断言--isBelow 或 isAtLeast
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=8').then(data => { assert.equal(data.assertions[0].method, 'isAtLeast', '5 is at least (>=) 5'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
- text: 选择正确的断言 - isBelow vs. isAtLeast
|
||||
- text: 请选择正确的断言--isBelow 或 isAtLeast
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=8').then(data => { assert.equal(data.assertions[1].method, 'isAtLeast', '2 * Math.random() is at least 0'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
- text: 选择正确的断言 - isBelow vs. isAtLeast
|
||||
- text: 请选择正确的断言--isBelow 或 isAtLeast
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=8').then(data => { assert.equal(data.assertions[2].method, 'isBelow', '1 is smaller than 2'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
- text: 选择正确的断言 - isBelow vs. isAtLeast
|
||||
- text: 请选择正确的断言--isBelow 或 isAtLeast
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=8').then(data => { assert.equal(data.assertions[3].method, 'isBelow', '2/3 (0.6666) is smaller than 1'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
|
||||
```
|
||||
@ -42,6 +47,11 @@ tests:
|
||||
<section id='solution'>
|
||||
|
||||
```js
|
||||
// solution required
|
||||
/**
|
||||
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>
|
||||
|
@ -2,15 +2,25 @@
|
||||
id: 587d824b367417b2b2512c48
|
||||
title: Use Assert.isOK and Assert.isNotOK
|
||||
challengeType: 2
|
||||
videoUrl: ''
|
||||
localeTitle: 使用Assert.isOK和Assert.isNotOK
|
||||
isHidden: false
|
||||
forumTopicId: 301607
|
||||
localeTitle: 使用 Assert.isok() 和 Assert.isNotOK()
|
||||
---
|
||||
|
||||
## Description
|
||||
<section id="description">提醒一下,这个项目是基于<a href="https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-mochachai/">Glitch</a>的以下入门项目构建的,或者是从<a href="https://github.com/freeCodeCamp/boilerplate-mochachai/">GitHub</a>克隆的。使用assert.isOk()或assert.isNotOk()来使测试通过。 .isOk(truthy)和.isNotOk(falsey)将通过。 </section>
|
||||
<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> 上克隆。
|
||||
|
||||
使用 assert.isOk() 或 assert.isNotOk() 通过测试。
|
||||
[Truthy 参考](https://developer.mozilla.org/en-US/docs/Glossary/Truthy)
|
||||
[Falsy 参考](https://developer.mozilla.org/en-US/docs/Glossary/Falsy)
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
<section id="instructions">
|
||||
<section id='instructions'>
|
||||
|
||||
.isOk(truthy) 或 .isNotOk(falsey) 可以通过测试。
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
@ -18,13 +28,13 @@ localeTitle: 使用Assert.isOK和Assert.isNotOK
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: 所有测试都应该通过
|
||||
- text: 需通过全部测试
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=2').then(data => {assert.equal(data.state,'passed'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
- text: 选择正确的断言 - isOk vs. isNotOk
|
||||
- text: 请选择正确的断言--isOk 或 isNotOk
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=2').then(data => { assert.equal(data.assertions[0].method, 'isNotOk', 'Null is falsy'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
- text: 选择正确的断言 - isOk vs. isNotOk
|
||||
- text: 请选择正确的断言--isOk 或 isNotOk
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=2').then(data => { assert.equal(data.assertions[1].method, 'isOk','A string is truthy'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
- text: 选择正确的断言 - isOk vs. isNotOk
|
||||
- text: 请选择正确的断言--isOk 或 isNotOk
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=2').then(data => { assert.equal(data.assertions[2].method, 'isOk', 'true is truthy'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
|
||||
```
|
||||
@ -40,6 +50,11 @@ tests:
|
||||
<section id='solution'>
|
||||
|
||||
```js
|
||||
// solution required
|
||||
/**
|
||||
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>
|
||||
|
@ -2,15 +2,21 @@
|
||||
id: 587d824d367417b2b2512c54
|
||||
title: Use Regular Expressions to Test a String
|
||||
challengeType: 2
|
||||
videoUrl: ''
|
||||
isHidden: false
|
||||
forumTopicId: 301608
|
||||
localeTitle: 使用正则表达式测试字符串
|
||||
---
|
||||
|
||||
## Description
|
||||
<section id="description">提醒一下,这个项目是基于<a href="https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-mochachai/">Glitch</a>的以下入门项目构建的,或者是从<a href="https://github.com/freeCodeCamp/boilerplate-mochachai/">GitHub</a>克隆的。 #match断言实际值与第二个参数正则表达式匹配。 </section>
|
||||
<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> 上克隆。
|
||||
#match 断言一个值匹配一个正则表达式(第二个参数)
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
<section id="instructions">
|
||||
<section id='instructions'>
|
||||
使用 <code>assert.match()</code> 来通过所有测试。
|
||||
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
@ -18,11 +24,11 @@ localeTitle: 使用正则表达式测试字符串
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: 所有测试都应该通过
|
||||
- text: 需通过全部测试
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=14').then(data => { assert.equal(data.state,'passed'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
- text: 选择正确的断言 - 匹配与非匹配
|
||||
- text: 请选择正确的断言--match 或 notMatch
|
||||
testString: 'getUserInput => $.get(getUserInput(''url'') + ''/_api/get-tests?type=unit&n=14'').then(data => { assert.equal(data.assertions[0].method, ''match'', ''\''# name: John Doe, age: 35\'' matches the regex''); }, xhr => { throw new Error(xhr.responseText); })'
|
||||
- text: 选择正确的断言 - 匹配与非匹配
|
||||
- text: 请选择正确的断言--match 或 notMatch
|
||||
testString: 'getUserInput => $.get(getUserInput(''url'') + ''/_api/get-tests?type=unit&n=14'').then(data => { assert.equal(data.assertions[1].method, ''notMatch'', ''\''# name: Paul Smith III, age: twenty-four\'' does not match the regex (the age must be numeric)''); }, xhr => { throw new Error(xhr.responseText); })'
|
||||
|
||||
```
|
||||
@ -38,6 +44,11 @@ tests:
|
||||
<section id='solution'>
|
||||
|
||||
```js
|
||||
// solution required
|
||||
/**
|
||||
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>
|
||||
|
@ -2,15 +2,21 @@
|
||||
id: 587d824b367417b2b2512c4a
|
||||
title: Use the Double Equals to Assert Equality
|
||||
challengeType: 2
|
||||
videoUrl: ''
|
||||
localeTitle: 使用Double Equals来断言平等
|
||||
isHidden: false
|
||||
forumTopicId: 301609
|
||||
localeTitle: 用两个等号断言相等
|
||||
---
|
||||
|
||||
## Description
|
||||
<section id="description">提醒一下,这个项目是基于<a href="https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-mochachai/">Glitch</a>的以下入门项目构建的,或者是从<a href="https://github.com/freeCodeCamp/boilerplate-mochachai/">GitHub</a>克隆的。 .equal(),. notEqual().equal()使用'=='比较对象</section>
|
||||
<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> 上克隆。
|
||||
.equal() 使用 '==' 比较对象
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
<section id="instructions">
|
||||
<section id='instructions'>
|
||||
使用 <code>assert.equal()</code> 或者 <code>assert.notEqual()</code> 来通过所有测试。
|
||||
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
@ -18,15 +24,15 @@ localeTitle: 使用Double Equals来断言平等
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: 所有测试都应该通过
|
||||
- text: 需通过全部测试
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=4').then(data => {assert.equal(data.state,'passed'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
- text: 选择正确的断言 - 相等与不等
|
||||
- text: 请选择正确的断言--equal 或 notEqual
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=4').then(data => { assert.equal(data.assertions[0].method, 'equal', 'Numbers are coerced into strings with == '); }, xhr => { throw new Error(xhr.responseText); })
|
||||
- text: 选择正确的断言 - 相等与不等
|
||||
- text: 请选择正确的断言--equal 或 notEqual
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=4').then(data => { assert.equal(data.assertions[1].method, 'notEqual', ' == compares object references'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
- text: 选择正确的断言 - 相等与不等
|
||||
- text: 请选择正确的断言--equal 或 notEqual
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=4').then(data => { assert.equal(data.assertions[2].method, 'equal', '6 * \'2\' is 12 ! It should be equal to \'12\''); }, xhr => { throw new Error(xhr.responseText); })
|
||||
- text: 选择正确的断言 - 相等与不等
|
||||
- text: 请选择正确的断言--equal 或 notEqual
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=4').then(data => { assert.equal(data.assertions[3].method, 'notEqual', '6 + \'2\' is \'62\'...'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
|
||||
```
|
||||
@ -42,6 +48,11 @@ tests:
|
||||
<section id='solution'>
|
||||
|
||||
```js
|
||||
// solution required
|
||||
/**
|
||||
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>
|
||||
|
@ -2,15 +2,21 @@
|
||||
id: 587d824b367417b2b2512c4b
|
||||
title: Use the Triple Equals to Assert Strict Equality
|
||||
challengeType: 2
|
||||
videoUrl: ''
|
||||
localeTitle: 使用Triple Equals断言严格平等
|
||||
isHidden: false
|
||||
forumTopicId: 301610
|
||||
localeTitle: 用三个等号断言严格相等
|
||||
---
|
||||
|
||||
## Description
|
||||
<section id="description">提醒一下,这个项目是基于<a href="https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-mochachai/">Glitch</a>的以下入门项目构建的,或者是从<a href="https://github.com/freeCodeCamp/boilerplate-mochachai/">GitHub</a>克隆的。 .strictEqual(),. notStrictEqual()。sqleEqual()使用'==='比较对象</section>
|
||||
<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> 上克隆。
|
||||
.strictEqual() 使用 '===' 比较对象
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
<section id="instructions">
|
||||
<section id='instructions'>
|
||||
使用 <code>assert.strictEqual()</code> 或者 <code>assert.notStrictEqual()</code> 来通过所有测试。
|
||||
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
@ -18,15 +24,15 @@ localeTitle: 使用Triple Equals断言严格平等
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: 所有测试都应该通过
|
||||
- text: 需通过全部测试
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=5').then(data => {assert.equal(data.state,'passed'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
- text: 选择正确的断言 - strictEqual vs. notStrictEqual
|
||||
- text: 请选择正确的断言--strictEqual 或 notStrictEqual
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=5').then(data => { assert.equal(data.assertions[0].method, 'notStrictEqual', 'with strictEqual the type must match'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
- text: 选择正确的断言 - strictEqual vs. notStrictEqual
|
||||
- text: 请选择正确的断言--strictEqual 或 notStrictEqual
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=5').then(data => { assert.equal(data.assertions[1].method, 'strictEqual', '3*2 = 6...'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
- text: 选择正确的断言 - strictEqual vs. notStrictEqual
|
||||
- text: 请选择正确的断言--strictEqual 或 notStrictEqual
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=5').then(data => { assert.equal(data.assertions[2].method, 'strictEqual', '6 * \'2\' is 12. Types match !'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
- text: 选择正确的断言 - strictEqual vs. notStrictEqual
|
||||
- text: 请选择正确的断言--strictEqual 或 notStrictEqual
|
||||
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=5').then(data => { assert.equal(data.assertions[3].method, 'notStrictEqual', 'Even if they have the same elements, the Arrays are notStrictEqual'); }, xhr => { throw new Error(xhr.responseText); })
|
||||
|
||||
```
|
||||
@ -42,6 +48,11 @@ tests:
|
||||
<section id='solution'>
|
||||
|
||||
```js
|
||||
// solution required
|
||||
/**
|
||||
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>
|
||||
|
Reference in New Issue
Block a user