fix: formatting code for quality assurance and testing with chai (#35471)
This commit is contained in:
committed by
The Coding Aviator
parent
78a4f45b0c
commit
a403dfe5e1
@ -7,8 +7,8 @@ challengeType: 2
|
||||
## Description
|
||||
<section id='description'>
|
||||
As a reminder, this project is being built upon the following starter project on <a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-mochachai/'>Glitch</a>, or cloned from <a href='https://github.com/freeCodeCamp/boilerplate-mochachai/'>GitHub</a>.
|
||||
.deepEqual(), .notDeepEqual()
|
||||
.deepEqual() asserts that two object are deep equal
|
||||
<code>.deepEqual()</code>, <code>.notDeepEqual()</code>.
|
||||
<code>.deepEqual()</code> asserts that two object are deep equal.
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
|
@ -7,7 +7,7 @@ challengeType: 2
|
||||
## Description
|
||||
<section id='description'>
|
||||
As a reminder, this project is being built upon the following starter project on <a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-mochachai/'>Glitch</a>, or cloned from <a href='https://github.com/freeCodeCamp/boilerplate-mochachai/'>GitHub</a>.
|
||||
.isAbove() => a > b , .isAtMost() => a <= b
|
||||
<code>.isAbove() => a > b</code> , <code>.isAtMost() => a <= b</code>.
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
|
@ -7,12 +7,12 @@ challengeType: 2
|
||||
## Description
|
||||
<section id='description'>
|
||||
As a reminder, this project is being built upon the following starter project on <a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-mochachai/'>Glitch</a>, or cloned from <a href='https://github.com/freeCodeCamp/boilerplate-mochachai/'>GitHub</a>.
|
||||
Use assert.isNull() or assert.isNotNull() to make the tests pass.
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
<section id='instructions'>
|
||||
|
||||
Use <code>assert.isNull()</code> or <code>assert.isNotNull()</code> to make the tests pass.
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
|
@ -8,20 +8,30 @@ challengeType: 2
|
||||
<section id='description'>
|
||||
As a reminder, this project is being built upon the following starter project on <a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-mochachai/'>Glitch</a>, or cloned from <a href='https://github.com/freeCodeCamp/boilerplate-mochachai/'>GitHub</a>.
|
||||
In the next example we'll see how to send data in a request payload (body).
|
||||
We are going to test a PUT request. The '/travellers' endpoint accepts
|
||||
a JSON object taking the structure :
|
||||
{surname: [last name of a traveller of the past]} ,
|
||||
We are going to test a PUT request. The <code>'/travellers'</code> endpoint accepts a JSON object taking the structure :
|
||||
<blockquote>
|
||||
{<br>
|
||||
surname: [last name of a traveller of the past]<br>
|
||||
} </blockquote>
|
||||
The route responds with :
|
||||
{name: [first name], surname:[last name], dates: [birth - death years]}
|
||||
see the server code for more details.
|
||||
Send {surname: 'Colombo'}. Replace assert.fail() and make the test pass.
|
||||
Check for 1) status, 2) type, 3) body.name, 4) body.surname
|
||||
Follow the assertion order above, We rely on it.
|
||||
<blockquote>
|
||||
{<br>
|
||||
name: [first name], surname:[last name], dates: [birth - death years]<br>
|
||||
}</blockquote>
|
||||
See the server code for more details.
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
<section id='instructions'>
|
||||
|
||||
Send <br>
|
||||
<blockquote>
|
||||
{<br>
|
||||
surname: 'Colombo'<br>
|
||||
}</blockquote>
|
||||
Replace <code>assert.fail()</code> and make the test pass.
|
||||
Check for 1) <code>status</code>, 2) <code>type</code>, 3) <code>body.name</code>, 4) <code>body.surname</code>.
|
||||
Follow the assertion order above, We rely on it.
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
|
@ -8,14 +8,18 @@ challengeType: 2
|
||||
<section id='description'>
|
||||
As a reminder, this project is being built upon the following starter project on <a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-mochachai/'>Glitch</a>, or cloned from <a href='https://github.com/freeCodeCamp/boilerplate-mochachai/'>GitHub</a>.
|
||||
This exercise is similar to the preceding. Look at it for the details.
|
||||
Send {surname: 'da Verrazzano'}. Replace assert.fail() and make the test pass.
|
||||
Check for 1) status, 2) type, 3) body.name, 4) body.surname
|
||||
Follow the assertion order above, We rely on it.
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
<section id='instructions'>
|
||||
|
||||
Send <br>
|
||||
<blockquote>
|
||||
{<br>
|
||||
surname: 'da Verrazzano'<br>
|
||||
}</blockquote>. Replace <code>assert.fail()</code> and make the test pass.
|
||||
Check for 1) <code>status</code>, 2) <code>type</code>, 3) <code>body.name</code>, 4) <code>body.surname</code>.
|
||||
Follow the assertion order above, We rely on it.
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
|
@ -7,13 +7,13 @@ challengeType: 2
|
||||
## Description
|
||||
<section id='description'>
|
||||
As a reminder, this project is being built upon the following starter project on <a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-mochachai/'>Glitch</a>, or cloned from <a href='https://github.com/freeCodeCamp/boilerplate-mochachai/'>GitHub</a>.
|
||||
Replace assert.fail(). Test the status and the text.response. Make the test pass.
|
||||
Send you name in the query appending ?name=<your_name>, the endpoint with responds with 'hello <your_name>'.
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
<section id='instructions'>
|
||||
|
||||
Replace <code>assert.fail()</code>. Test the status and the <code>text.response</code>. Make the test pass.
|
||||
Send you name in the query appending <code>?name=<your_name></code>, the endpoint with responds with <code>'hello <your_name>'</code>.
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
|
@ -7,13 +7,13 @@ challengeType: 2
|
||||
## Description
|
||||
<section id='description'>
|
||||
As a reminder, this project is being built upon the following starter project on <a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-mochachai/'>Glitch</a>, or cloned from <a href='https://github.com/freeCodeCamp/boilerplate-mochachai/'>GitHub</a>.
|
||||
Replace assert.fail(). Test the status and the text.response. Make the test pass.
|
||||
Don't send a name in the query, the endpoint with responds with 'hello Guest'.
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
<section id='instructions'>
|
||||
|
||||
Replace <code>assert.fail()</code>. Test the status and the text.response. Make the test pass.
|
||||
Don't send a name in the query, the endpoint with responds with <code>'hello Guest'</code>.
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
|
@ -7,13 +7,13 @@ challengeType: 2
|
||||
## Description
|
||||
<section id='description'>
|
||||
As a reminder, this project is being built upon the following starter project on <a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-mochachai/'>Glitch</a>, or cloned from <a href='https://github.com/freeCodeCamp/boilerplate-mochachai/'>GitHub</a>.
|
||||
This exercise is similar to the preceding.
|
||||
Look at the code for directions. Follow the assertions order, We rely on it.
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
<section id='instructions'>
|
||||
|
||||
This exercise is similar to the preceding.
|
||||
Look at the code for directions. Follow the assertions order, We rely on it.
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
|
@ -9,13 +9,13 @@ challengeType: 2
|
||||
As a reminder, this project is being built upon the following starter project on <a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-mochachai/'>Glitch</a>, or cloned from <a href='https://github.com/freeCodeCamp/boilerplate-mochachai/'>GitHub</a>.
|
||||
In the next challenges we are going to simulate the human interaction with a page using a device called 'Headless Browser'.
|
||||
A headless browser is a web browser without a graphical user interface. These kind of tools are particularly useful for testing web pages as they are able to render and understand HTML, CSS, and JavaScript the same way a browser would.
|
||||
For these challenges we are using Zombie.JS. It's a lightweight browser which is totally based on JS, without relying on additional binaries to be installed. This feature makes it usable in an environment such as Glitch. There are many other (more powerful) options.<br>
|
||||
Look at the examples in the code for the exercise directions Follow the assertions order, We rely on it.
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
<section id='instructions'>
|
||||
|
||||
For these challenges we are using Zombie.JS. It's a lightweight browser which is totally based on JS, without relying on additional binaries to be installed. This feature makes it usable in an environment such as Glitch. There are many other (more powerful) options.<br>
|
||||
Look at the examples in the code for the exercise directions Follow the assertions order, We rely on it.
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
|
@ -7,14 +7,14 @@ challengeType: 2
|
||||
## Description
|
||||
<section id='description'>
|
||||
As a reminder, this project is being built upon the following starter project on <a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-mochachai/'>Glitch</a>, or cloned from <a href='https://github.com/freeCodeCamp/boilerplate-mochachai/'>GitHub</a>.
|
||||
Use assert.isTrue() or assert.isNotTrue() to make the tests pass.
|
||||
.isTrue(true) and .isNotTrue(everything else) will pass.
|
||||
.isFalse() and .isNotFalse() also exist.
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
<section id='instructions'>
|
||||
|
||||
Use <code>assert.isTrue()</code> or <code>assert.isNotTrue()</code> to make the tests pass.
|
||||
<code>.isTrue(true)</code> and <code>.isNotTrue(everything else)</code> will pass.
|
||||
<code>.isFalse()</code> and <code>.isNotFalse()</code> also exist.
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
|
@ -7,8 +7,8 @@ challengeType: 2
|
||||
## Description
|
||||
<section id='description'>
|
||||
As a reminder, this project is being built upon the following starter project on <a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-mochachai/'>Glitch</a>, or cloned from <a href='https://github.com/freeCodeCamp/boilerplate-mochachai/'>GitHub</a>.
|
||||
#include (on #notInclude ) works for strings too !!
|
||||
It asserts that the actual string contains the expected substring
|
||||
<code>#include (or #notInclude)</code> works for strings too!!
|
||||
It asserts that the actual string contains the expected substring.
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
|
@ -7,16 +7,15 @@ challengeType: 2
|
||||
## Description
|
||||
<section id='description'>
|
||||
As a reminder, this project is being built upon the following starter project on <a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-mochachai/'>Glitch</a>, or cloned from <a href='https://github.com/freeCodeCamp/boilerplate-mochachai/'>GitHub</a>.
|
||||
.approximately
|
||||
.approximately(actual, expected, range, [message])
|
||||
actual = expected +/- range
|
||||
Choose the minimum range (3rd parameter) to make the test always pass
|
||||
it should be less than 1
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
<section id='instructions'>
|
||||
|
||||
<code>.approximately</code>
|
||||
<code>.approximately(actual, expected, range, [message])</code>
|
||||
<code>actual = expected +/- range</code>
|
||||
Choose the minimum range (3rd parameter) to make the test always pass. It should be less than 1.
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
|
@ -7,7 +7,7 @@ challengeType: 2
|
||||
## Description
|
||||
<section id='description'>
|
||||
As a reminder, this project is being built upon the following starter project on <a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-mochachai/'>Glitch</a>, or cloned from <a href='https://github.com/freeCodeCamp/boilerplate-mochachai/'>GitHub</a>.
|
||||
#isString asserts that the actual value is a string.
|
||||
<code>#isString</code> or <code>#isNotString</code> asserts that the actual value is a string.
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
|
@ -7,13 +7,13 @@ challengeType: 2
|
||||
## Description
|
||||
<section id='description'>
|
||||
As a reminder, this project is being built upon the following starter project on <a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-mochachai/'>Glitch</a>, or cloned from <a href='https://github.com/freeCodeCamp/boilerplate-mochachai/'>GitHub</a>.
|
||||
#typeOf asserts that value’s type is the given string, as determined by Object.prototype.toString.
|
||||
Use #typeOf or #notTypeOf where appropriate
|
||||
<code>#typeOf</code> asserts that value’s type is the given string, as determined by <code>Object.prototype.toString</code>.
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
<section id='instructions'>
|
||||
|
||||
Use <code>#typeOf</code> or <code>#notTypeOf</code> where it is appropriate.
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
|
@ -7,12 +7,12 @@ challengeType: 2
|
||||
## Description
|
||||
<section id='description'>
|
||||
As a reminder, this project is being built upon the following starter project on <a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-mochachai/'>Glitch</a>, or cloned from <a href='https://github.com/freeCodeCamp/boilerplate-mochachai/'>GitHub</a>.
|
||||
Use assert.isDefined() or assert.isUndefined() to make the tests pass
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
<section id='instructions'>
|
||||
|
||||
Use <code>assert.isDefined()</code> or <code>assert.isUndefined()</code> to make the tests pass.
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
|
@ -7,13 +7,13 @@ challengeType: 2
|
||||
## Description
|
||||
<section id='description'>
|
||||
As a reminder, this project is being built upon the following starter project on <a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-mochachai/'>Glitch</a>, or cloned from <a href='https://github.com/freeCodeCamp/boilerplate-mochachai/'>GitHub</a>.
|
||||
#property asserts that the actual object has a given property.
|
||||
Use #property or #notProperty where appropriate
|
||||
<code>#property</code> asserts that the actual object has a given property.
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
<section id='instructions'>
|
||||
|
||||
Use <code>#property</code> or <code>#notProperty</code> where it is appropriate.
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
|
@ -7,13 +7,13 @@ challengeType: 2
|
||||
## Description
|
||||
<section id='description'>
|
||||
As a reminder, this project is being built upon the following starter project on <a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-mochachai/'>Glitch</a>, or cloned from <a href='https://github.com/freeCodeCamp/boilerplate-mochachai/'>GitHub</a>.
|
||||
#instanceOf asserts that an object is an instance of a constructor.
|
||||
Use #instanceOf or #notInstanceOf where appropriate
|
||||
<code>#instanceOf</code> asserts that an object is an instance of a constructor.
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
<section id='instructions'>
|
||||
|
||||
Use <code>#instanceOf</code> or <code>#notInstanceOf</code> where it is appropriate.
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
|
@ -7,7 +7,7 @@ challengeType: 2
|
||||
## Description
|
||||
<section id='description'>
|
||||
As a reminder, this project is being built upon the following starter project on <a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-mochachai/'>Glitch</a>, or cloned from <a href='https://github.com/freeCodeCamp/boilerplate-mochachai/'>GitHub</a>.
|
||||
.isBelow() => a < b , .isAtLeast => a >= b
|
||||
<code>.isBelow() => a < b</code> , <code>.isAtLeast => a >= b</code>.
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
|
@ -7,13 +7,13 @@ challengeType: 2
|
||||
## Description
|
||||
<section id='description'>
|
||||
As a reminder, this project is being built upon the following starter project on <a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-mochachai/'>Glitch</a>, or cloned from <a href='https://github.com/freeCodeCamp/boilerplate-mochachai/'>GitHub</a>.
|
||||
Use assert.isOk() or assert.isNotOk() to make the tests pass.
|
||||
.isOk(truthy) and .isNotOk(falsey) will pass.
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
<section id='instructions'>
|
||||
|
||||
Use <code>assert.isOk()</code> or <code>assert.isNotOk()</code> to make the tests pass.
|
||||
<code>.isOk(truthy)</code> and <code>.isNotOk(falsey)</code> will pass.
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
|
@ -7,8 +7,7 @@ challengeType: 2
|
||||
## Description
|
||||
<section id='description'>
|
||||
As a reminder, this project is being built upon the following starter project on <a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-mochachai/'>Glitch</a>, or cloned from <a href='https://github.com/freeCodeCamp/boilerplate-mochachai/'>GitHub</a>.
|
||||
#match Asserts that the actual value
|
||||
matches the second argument regular expression.
|
||||
<code>#match</code> asserts that the actual value matches the second argument regular expression.
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
|
@ -7,8 +7,8 @@ challengeType: 2
|
||||
## Description
|
||||
<section id='description'>
|
||||
As a reminder, this project is being built upon the following starter project on <a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-mochachai/'>Glitch</a>, or cloned from <a href='https://github.com/freeCodeCamp/boilerplate-mochachai/'>GitHub</a>.
|
||||
.equal(), .notEqual()
|
||||
.equal() compares objects using '=='
|
||||
<code>.equal()</code>, <code>.notEqual()</code>.
|
||||
<code>.equal()</code> compares objects using <code>'=='</code>.
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
|
@ -7,8 +7,8 @@ challengeType: 2
|
||||
## Description
|
||||
<section id='description'>
|
||||
As a reminder, this project is being built upon the following starter project on <a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-mochachai/'>Glitch</a>, or cloned from <a href='https://github.com/freeCodeCamp/boilerplate-mochachai/'>GitHub</a>.
|
||||
.strictEqual(), .notStrictEqual()
|
||||
.strictEqual() compares objects using '==='
|
||||
<code>.strictEqual()</code>, <code>.notStrictEqual()</code>.
|
||||
<code>.strictEqual()</code> compares objects using <code>'==='</code>.
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
|
Reference in New Issue
Block a user