fix(curriculum): ensure empty array doesn't pass tests in Quiz Game (#57698)

This commit is contained in:
Krzysztof G. 2024-12-23 08:38:31 +01:00 committed by GitHub
parent 5077b0e6db
commit 4025aba7a3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -43,12 +43,14 @@ questions.forEach(question => {
The `category` key should have the value of a string representing a question category.
```js
assert.isNotEmpty(questions);
questions.forEach(({category}) => assert.isString(category));
```
The `question` key should have the value of a string representing a question.
```js
assert.isNotEmpty(questions);
questions.forEach(({question}) => {
assert.isString(question);
assert.include(question, '?');
@ -58,6 +60,7 @@ questions.forEach(({question}) => {
The `choices` key should have the value of an array containing three strings.
```js
assert.isNotEmpty(questions);
questions.forEach(({choices}) => {
assert.isArray(choices);
assert.lengthOf(choices, 3);
@ -68,12 +71,14 @@ questions.forEach(({choices}) => {
The `answer` key should have the value of a string.
```js
assert.isNotEmpty(questions);
questions.forEach(({answer}) => assert.isString(answer));
```
The value of `answer` should be included in the `choices` array.
```js
assert.isNotEmpty(questions);
questions.forEach(({answer, choices}) => assert.oneOf(answer, choices));
```