2.7 KiB
2.7 KiB
id, title, challengeType, forumTopicId, dashedName
id | title | challengeType | forumTopicId | dashedName |
---|---|---|---|---|
587d824a367417b2b2512c46 | JavaScript アサーションがどのように機能するかを学ぶ | 2 | 301589 | learn-how-javascript-assertions-work |
--description--
これらのチャレンジに取り組むにあたり、以下の方法のうち 1 つを用いてコードを記述します。
- GitHub レポジトリをクローンし、ローカル環境でチャレンジを完了させる。
- Replit 始動プロジェクトを使用してチャレンジを完了させる。
- 使い慣れたサイトビルダーを使用してプロジェクトを完了させる。 必ず GitHub リポジトリのすべてのファイルを取り込む。
完了したら、プロジェクトの動作デモをどこか公開の場にホストしてください。 そして、Solution Link
フィールドでデモへの URL を送信してください。
--instructions--
tests/1_unit-tests.js
の中の、Basic Assertions
スイート内の #1
に分類されたテストにおいて、テストを合格にする (true
と評価する必要があります) ために、それぞれの assert
を assert.isNull
または assert.isNotNull
に変更してください。 アサートに渡された引数を変更しないでください。
--hints--
すべてのテストに合格する必要があります。
(getUserInput) =>
$.get(getUserInput('url') + '/_api/get-tests?type=unit&n=0').then(
(data) => {
assert.equal(data.state, 'passed');
},
(xhr) => {
throw new Error(xhr.responseText);
}
);
最初のアサーションに対して、正しいメソッドを選ぶ必要があります - isNull
もしくは isNotNull
です。
(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);
}
);
2 番目のアサーションに対して、正しいメソッドを選ぶ必要があります- isNull
もしくは isNotNull
です。
(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);
}
);
--solutions--
/**
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.
*/