Files
freeCodeCamp/curriculum/challenges/japanese/06-quality-assurance/quality-assurance-and-testing-with-chai/test-if-one-value-is-below-or-at-least-as-large-as-another.md
2022-01-20 20:30:18 +01:00

110 lines
3.2 KiB
Markdown

---
id: 587d824c367417b2b2512c4e
title: ある値が、他の値より小さいか、もしくは他の値以上かをテストする
challengeType: 2
forumTopicId: 301606
dashedName: test-if-one-value-is-below-or-at-least-as-large-as-another
---
# --description--
注意点として、このプロジェクトは [Replit](https://replit.com/github/freeCodeCamp/boilerplate-mochachai) の始動プロジェクト、または [GitHub](https://github.com/freeCodeCamp/boilerplate-mochachai/) からクローンされたプロジェクトに基づいて構築されています。
# --instructions--
`tests/1_unit-tests.js` の中の、`Comparisons` スイート内の `#9` に分類されたテストにおいて、テストを合格にする (`true` と評価する必要があります) ために、それぞれの `assert``assert.isBelow` または `assert.isAtLeast` に変更してください。 アサートに渡された引数を変更しないでください。
# --hints--
すべてのテストに合格する必要があります。
```js
(getUserInput) =>
$.get(getUserInput('url') + '/_api/get-tests?type=unit&n=8').then(
(data) => {
assert.equal(data.state, 'passed');
},
(xhr) => {
throw new Error(xhr.responseText);
}
);
```
最初のアサーションに対して、正しいメソッドを選ぶ必要があります - `isBelow` もしくは `isAtLeast` です。
```js
(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);
}
);
```
2 番目のアサーションに対して、正しいメソッドを選ぶ必要があります - `isBelow` もしくは `isAtLeast` です。
```js
(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);
}
);
```
3 番目のアサーションに対して、正しいメソッドを選ぶ必要があります - `isBelow` もしくは `isAtLeast` です。
```js
(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);
}
);
```
4 番目のアサーションに対して、正しいメソッドを選ぶ必要があります - `isBelow` もしくは `isAtLeast` です。
```js
(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);
}
);
```
# --solutions--
```js
/**
Backend challenges don't need solutions,
because they would need to be tested against a full working project.
Please check our contributing guidelines to learn more.
*/
```