Files

110 lines
3.1 KiB
Markdown
Raw Permalink Normal View History

---
id: 587d824c367417b2b2512c4d
title: 2 つの要素のプロパティを比較する
challengeType: 2
forumTopicId: 301588
dashedName: compare-the-properties-of-two-elements
---
# --description--
注意点として、このプロジェクトは [Replit](https://replit.com/github/freeCodeCamp/boilerplate-mochachai) の始動プロジェクト、または [GitHub](https://github.com/freeCodeCamp/boilerplate-mochachai/) からクローンされたプロジェクトに基づいて構築されています。
# --instructions--
`tests/1_unit-tests.js` の中の、`Comparisons` スイート内の `#8` に分類されたテストにおいて、テストを合格にする (`true` と評価する必要があります) ために、それぞれの `assert``assert.isAbove` または `assert.isAtMost` に変更してください。 アサートに渡された引数を変更しないでください。
# --hints--
すべてのテストに合格する必要があります。
```js
(getUserInput) =>
$.get(getUserInput('url') + '/_api/get-tests?type=unit&n=7').then(
(data) => {
assert.equal(data.state, 'passed');
},
(xhr) => {
throw new Error(xhr.responseText);
}
);
```
最初のアサーションに、正しいメソッドを選ぶ必要があります - `isAbove` もしくは `isAtMost` です。
```js
(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);
}
);
```
2 番目のアサーションに、正しいメソッドを選ぶ必要があります- `isAbove` もしくは `isAtMost` です。
```js
(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);
}
);
```
3 番目のアサーションに、正しいメソッドを選ぶ必要があります- `isAbove` もしくは `isAtMost` です。
```js
(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);
}
);
```
4 番目のアサーションに、正しいメソッドを選ぶ必要があります - `isAbove` もしくは `isAtMost` です。
```js
(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);
}
);
```
# --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.
*/
```