chore(i18n,learn): processed translations (#45235)

This commit is contained in:
camperbot
2022-02-25 00:11:18 +05:30
committed by GitHub
parent 8ee7aa08f8
commit 0d26a9e29d
27 changed files with 658 additions and 504 deletions

View File

@ -42,19 +42,19 @@ let camper = "David";
`var` 不應存在於代碼中。 `var` 不應存在於代碼中。
```js ```js
(getUserInput) => assert(!getUserInput('index').match(/var/g)); assert.notMatch(code, /var/g);
``` ```
`catName` 應該是字符串 `Oliver` `catName` 應該是字符串 `Oliver`
```js ```js
assert(catName === 'Oliver'); assert.equal(catName, 'Oliver');
``` ```
`catSound` 應該是字符串 `Meow!` `catSound` 應該是字符串 `Meow!`
```js ```js
assert(catSound === 'Meow!'); assert.equal(catSound, 'Meow!');
``` ```
# --seed-- # --seed--

View File

@ -129,17 +129,21 @@ async (getUserInput) => {
```js ```js
async (getUserInput) => { async (getUserInput) => {
const input = const inputs = [
'9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..'; '..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6.',
'..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6...'
];
const output = 'Expected puzzle to be 81 characters long'; const output = 'Expected puzzle to be 81 characters long';
const data = await fetch(getUserInput('url') + '/api/solve', { for (const input of inputs) {
method: 'POST', const data = await fetch(getUserInput('url') + '/api/solve', {
headers: { 'Content-Type': 'application/json' }, method: 'POST',
body: JSON.stringify({ puzzle: input }) headers: { 'Content-Type': 'application/json' },
}); body: JSON.stringify({ puzzle: input })
const parsed = await data.json(); });
assert.property(parsed, 'error'); const parsed = await data.json();
assert.equal(parsed.error, output); assert.property(parsed, 'error');
assert.equal(parsed.error, output);
}
}; };
``` ```
@ -246,19 +250,23 @@ async (getUserInput) => {
```js ```js
async (getUserInput) => { async (getUserInput) => {
const input = const inputs = [
'9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..'; '..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6.',
'..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6...'
];
const coordinate = 'A1'; const coordinate = 'A1';
const value = '1'; const value = '1';
const output = 'Expected puzzle to be 81 characters long'; const output = 'Expected puzzle to be 81 characters long';
const data = await fetch(getUserInput('url') + '/api/check', { for (const input of inputs) {
method: 'POST', const data = await fetch(getUserInput('url') + '/api/check', {
headers: { 'Content-Type': 'application/json' }, method: 'POST',
body: JSON.stringify({ puzzle: input, coordinate, value }) headers: { 'Content-Type': 'application/json' },
}); body: JSON.stringify({ puzzle: input, coordinate, value })
const parsed = await data.json(); });
assert.property(parsed, 'error'); const parsed = await data.json();
assert.equal(parsed.error, output); assert.property(parsed, 'error');
assert.equal(parsed.error, output);
}
}; };
``` ```
@ -266,17 +274,31 @@ async (getUserInput) => {
```js ```js
async (getUserInput) => { async (getUserInput) => {
const input = const inputs = [
'..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..'; {
const output = 'Required field(s) missing'; puzzle: '..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..',
const data = await fetch(getUserInput('url') + '/api/check', { value: '1',
method: 'POST', },
headers: { 'Content-Type': 'application/json' }, {
body: JSON.stringify({ puzzle: input }) puzzle: '..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..',
}); coordinate: 'A1',
const parsed = await data.json(); },
assert.property(parsed, 'error'); {
assert.equal(parsed.error, output); coordinate: 'A1',
value: '1'
}
];
for (const input of inputs) {
const output = 'Required field(s) missing';
const data = await fetch(getUserInput('url') + '/api/check', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(input)
});
const parsed = await data.json();
assert.property(parsed, 'error');
assert.equal(parsed.error, output);
}
}; };
``` ```
@ -287,16 +309,18 @@ async (getUserInput) => {
const input = const input =
'..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..'; '..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..';
const output = 'Invalid coordinate'; const output = 'Invalid coordinate';
const coordinate = 'XZ18'; const coordinates = ['A0', 'A10', 'J1', 'A', '1', 'XZ18'];
const value = '7'; const value = '7';
const data = await fetch(getUserInput('url') + '/api/check', { for (const coordinate of coordinates) {
method: 'POST', const data = await fetch(getUserInput('url') + '/api/check', {
headers: { 'Content-Type': 'application/json' }, method: 'POST',
body: JSON.stringify({ puzzle: input, coordinate, value }) headers: { 'Content-Type': 'application/json' },
}); body: JSON.stringify({ puzzle: input, coordinate, value })
const parsed = await data.json(); });
assert.property(parsed, 'error'); const parsed = await data.json();
assert.equal(parsed.error, output); assert.property(parsed, 'error');
assert.equal(parsed.error, output);
}
}; };
``` ```
@ -308,15 +332,17 @@ async (getUserInput) => {
'..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..'; '..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..';
const output = 'Invalid value'; const output = 'Invalid value';
const coordinate = 'A1'; const coordinate = 'A1';
const value = 'X'; const values = ['0', '10', 'A'];
const data = await fetch(getUserInput('url') + '/api/check', { for (const value of values) {
method: 'POST', const data = await fetch(getUserInput('url') + '/api/check', {
headers: { 'Content-Type': 'application/json' }, method: 'POST',
body: JSON.stringify({ puzzle: input, coordinate, value }) headers: { 'Content-Type': 'application/json' },
}); body: JSON.stringify({ puzzle: input, coordinate, value })
const parsed = await data.json(); });
assert.property(parsed, 'error'); const parsed = await data.json();
assert.equal(parsed.error, output); assert.property(parsed, 'error');
assert.equal(parsed.error, output);
}
}; };
``` ```

View File

@ -42,19 +42,19 @@ let camper = "David";
`var` 不应存在于代码中。 `var` 不应存在于代码中。
```js ```js
(getUserInput) => assert(!getUserInput('index').match(/var/g)); assert.notMatch(code, /var/g);
``` ```
`catName` 应该是字符串 `Oliver` `catName` 应该是字符串 `Oliver`
```js ```js
assert(catName === 'Oliver'); assert.equal(catName, 'Oliver');
``` ```
`catSound` 应该是字符串 `Meow!` `catSound` 应该是字符串 `Meow!`
```js ```js
assert(catSound === 'Meow!'); assert.equal(catSound, 'Meow!');
``` ```
# --seed-- # --seed--

View File

@ -129,17 +129,21 @@ async (getUserInput) => {
```js ```js
async (getUserInput) => { async (getUserInput) => {
const input = const inputs = [
'9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..'; '..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6.',
'..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6...'
];
const output = 'Expected puzzle to be 81 characters long'; const output = 'Expected puzzle to be 81 characters long';
const data = await fetch(getUserInput('url') + '/api/solve', { for (const input of inputs) {
method: 'POST', const data = await fetch(getUserInput('url') + '/api/solve', {
headers: { 'Content-Type': 'application/json' }, method: 'POST',
body: JSON.stringify({ puzzle: input }) headers: { 'Content-Type': 'application/json' },
}); body: JSON.stringify({ puzzle: input })
const parsed = await data.json(); });
assert.property(parsed, 'error'); const parsed = await data.json();
assert.equal(parsed.error, output); assert.property(parsed, 'error');
assert.equal(parsed.error, output);
}
}; };
``` ```
@ -246,19 +250,23 @@ async (getUserInput) => {
```js ```js
async (getUserInput) => { async (getUserInput) => {
const input = const inputs = [
'9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..'; '..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6.',
'..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6...'
];
const coordinate = 'A1'; const coordinate = 'A1';
const value = '1'; const value = '1';
const output = 'Expected puzzle to be 81 characters long'; const output = 'Expected puzzle to be 81 characters long';
const data = await fetch(getUserInput('url') + '/api/check', { for (const input of inputs) {
method: 'POST', const data = await fetch(getUserInput('url') + '/api/check', {
headers: { 'Content-Type': 'application/json' }, method: 'POST',
body: JSON.stringify({ puzzle: input, coordinate, value }) headers: { 'Content-Type': 'application/json' },
}); body: JSON.stringify({ puzzle: input, coordinate, value })
const parsed = await data.json(); });
assert.property(parsed, 'error'); const parsed = await data.json();
assert.equal(parsed.error, output); assert.property(parsed, 'error');
assert.equal(parsed.error, output);
}
}; };
``` ```
@ -266,17 +274,31 @@ async (getUserInput) => {
```js ```js
async (getUserInput) => { async (getUserInput) => {
const input = const inputs = [
'..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..'; {
const output = 'Required field(s) missing'; puzzle: '..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..',
const data = await fetch(getUserInput('url') + '/api/check', { value: '1',
method: 'POST', },
headers: { 'Content-Type': 'application/json' }, {
body: JSON.stringify({ puzzle: input }) puzzle: '..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..',
}); coordinate: 'A1',
const parsed = await data.json(); },
assert.property(parsed, 'error'); {
assert.equal(parsed.error, output); coordinate: 'A1',
value: '1'
}
];
for (const input of inputs) {
const output = 'Required field(s) missing';
const data = await fetch(getUserInput('url') + '/api/check', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(input)
});
const parsed = await data.json();
assert.property(parsed, 'error');
assert.equal(parsed.error, output);
}
}; };
``` ```
@ -287,16 +309,18 @@ async (getUserInput) => {
const input = const input =
'..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..'; '..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..';
const output = 'Invalid coordinate'; const output = 'Invalid coordinate';
const coordinate = 'XZ18'; const coordinates = ['A0', 'A10', 'J1', 'A', '1', 'XZ18'];
const value = '7'; const value = '7';
const data = await fetch(getUserInput('url') + '/api/check', { for (const coordinate of coordinates) {
method: 'POST', const data = await fetch(getUserInput('url') + '/api/check', {
headers: { 'Content-Type': 'application/json' }, method: 'POST',
body: JSON.stringify({ puzzle: input, coordinate, value }) headers: { 'Content-Type': 'application/json' },
}); body: JSON.stringify({ puzzle: input, coordinate, value })
const parsed = await data.json(); });
assert.property(parsed, 'error'); const parsed = await data.json();
assert.equal(parsed.error, output); assert.property(parsed, 'error');
assert.equal(parsed.error, output);
}
}; };
``` ```
@ -308,15 +332,17 @@ async (getUserInput) => {
'..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..'; '..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..';
const output = 'Invalid value'; const output = 'Invalid value';
const coordinate = 'A1'; const coordinate = 'A1';
const value = 'X'; const values = ['0', '10', 'A'];
const data = await fetch(getUserInput('url') + '/api/check', { for (const value of values) {
method: 'POST', const data = await fetch(getUserInput('url') + '/api/check', {
headers: { 'Content-Type': 'application/json' }, method: 'POST',
body: JSON.stringify({ puzzle: input, coordinate, value }) headers: { 'Content-Type': 'application/json' },
}); body: JSON.stringify({ puzzle: input, coordinate, value })
const parsed = await data.json(); });
assert.property(parsed, 'error'); const parsed = await data.json();
assert.equal(parsed.error, output); assert.property(parsed, 'error');
assert.equal(parsed.error, output);
}
}; };
``` ```

View File

@ -32,16 +32,14 @@ Cambia el código para que todas las variables se declaren con `let` o `const`.
`var` no debe existir en tu código. `var` no debe existir en tu código.
```js ```js
(getUserInput) => assert(!getUserInput('index').match(/var/g)); assert.notMatch(code, /var/g);
``` ```
Debes cambiar `fCC` a todas mayúsculas. Debes cambiar `fCC` a todas mayúsculas.
```js ```js
(getUserInput) => { assert.match(code, /(FCC)/);
assert(getUserInput('index').match(/(FCC)/)); assert.notMatch(code, /(fCC)/);
assert(!getUserInput('index').match(/fCC/));
}
``` ```
`FCC` debe ser una variable constante declarada con `const`. `FCC` debe ser una variable constante declarada con `const`.
@ -54,14 +52,13 @@ assert.match(code, /const\s+FCC/);
`fact` debe ser declarada con `let`. `fact` debe ser declarada con `let`.
```js ```js
(getUserInput) => assert(getUserInput('index').match(/(let fact)/g)); assert.match(code, /(let\s+fact)/g);
``` ```
`console.log` debe cambiarse para imprimir las variables `FCC` y `fact`. `console.log` debe cambiarse para imprimir las variables `FCC` y `fact`.
```js ```js
(getUserInput) => assert.match(code, /console\.log\(\s*FCC\s*\,\s*fact\s*\)\s*;?/g);
assert(getUserInput('index').match(/console\.log\(\s*FCC\s*\,\s*fact\s*\)\s*;?/g));
``` ```
# --seed-- # --seed--

View File

@ -42,19 +42,19 @@ Actualiza el código para que solo utilice la palabra clave `let`.
`var` no debe existir en el código. `var` no debe existir en el código.
```js ```js
(getUserInput) => assert(!getUserInput('index').match(/var/g)); assert.notMatch(code, /var/g);
``` ```
`catName` debe ser la cadena `Oliver`. `catName` debe ser la cadena `Oliver`.
```js ```js
assert(catName === 'Oliver'); assert.equal(catName, 'Oliver');
``` ```
`catSound` debe ser la cadena `Meow!` `catSound` debe ser la cadena `Meow!`
```js ```js
assert(catSound === 'Meow!'); assert.equal(catSound, 'Meow!');
``` ```
# --seed-- # --seed--

View File

@ -129,17 +129,21 @@ Si el rompecabezas enviado a `/api/solve` es mayor o menor que 81 caracteres, el
```js ```js
async (getUserInput) => { async (getUserInput) => {
const input = const inputs = [
'9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..'; '..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6.',
'..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6...'
];
const output = 'Expected puzzle to be 81 characters long'; const output = 'Expected puzzle to be 81 characters long';
const data = await fetch(getUserInput('url') + '/api/solve', { for (const input of inputs) {
method: 'POST', const data = await fetch(getUserInput('url') + '/api/solve', {
headers: { 'Content-Type': 'application/json' }, method: 'POST',
body: JSON.stringify({ puzzle: input }) headers: { 'Content-Type': 'application/json' },
}); body: JSON.stringify({ puzzle: input })
const parsed = await data.json(); });
assert.property(parsed, 'error'); const parsed = await data.json();
assert.equal(parsed.error, output); assert.property(parsed, 'error');
assert.equal(parsed.error, output);
}
}; };
``` ```
@ -246,19 +250,23 @@ Si el rompecabezas enviado a `/api/check` es mayor o menor que 81 caracteres, el
```js ```js
async (getUserInput) => { async (getUserInput) => {
const input = const inputs = [
'9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..'; '..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6.',
'..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6...'
];
const coordinate = 'A1'; const coordinate = 'A1';
const value = '1'; const value = '1';
const output = 'Expected puzzle to be 81 characters long'; const output = 'Expected puzzle to be 81 characters long';
const data = await fetch(getUserInput('url') + '/api/check', { for (const input of inputs) {
method: 'POST', const data = await fetch(getUserInput('url') + '/api/check', {
headers: { 'Content-Type': 'application/json' }, method: 'POST',
body: JSON.stringify({ puzzle: input, coordinate, value }) headers: { 'Content-Type': 'application/json' },
}); body: JSON.stringify({ puzzle: input, coordinate, value })
const parsed = await data.json(); });
assert.property(parsed, 'error'); const parsed = await data.json();
assert.equal(parsed.error, output); assert.property(parsed, 'error');
assert.equal(parsed.error, output);
}
}; };
``` ```
@ -266,17 +274,31 @@ Si el objeto enviado a `/api/check` no existe `puzzle`,`coordinate` o `value`, e
```js ```js
async (getUserInput) => { async (getUserInput) => {
const input = const inputs = [
'..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..'; {
const output = 'Required field(s) missing'; puzzle: '..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..',
const data = await fetch(getUserInput('url') + '/api/check', { value: '1',
method: 'POST', },
headers: { 'Content-Type': 'application/json' }, {
body: JSON.stringify({ puzzle: input }) puzzle: '..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..',
}); coordinate: 'A1',
const parsed = await data.json(); },
assert.property(parsed, 'error'); {
assert.equal(parsed.error, output); coordinate: 'A1',
value: '1'
}
];
for (const input of inputs) {
const output = 'Required field(s) missing';
const data = await fetch(getUserInput('url') + '/api/check', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(input)
});
const parsed = await data.json();
assert.property(parsed, 'error');
assert.equal(parsed.error, output);
}
}; };
``` ```
@ -287,16 +309,18 @@ async (getUserInput) => {
const input = const input =
'..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..'; '..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..';
const output = 'Invalid coordinate'; const output = 'Invalid coordinate';
const coordinate = 'XZ18'; const coordinates = ['A0', 'A10', 'J1', 'A', '1', 'XZ18'];
const value = '7'; const value = '7';
const data = await fetch(getUserInput('url') + '/api/check', { for (const coordinate of coordinates) {
method: 'POST', const data = await fetch(getUserInput('url') + '/api/check', {
headers: { 'Content-Type': 'application/json' }, method: 'POST',
body: JSON.stringify({ puzzle: input, coordinate, value }) headers: { 'Content-Type': 'application/json' },
}); body: JSON.stringify({ puzzle: input, coordinate, value })
const parsed = await data.json(); });
assert.property(parsed, 'error'); const parsed = await data.json();
assert.equal(parsed.error, output); assert.property(parsed, 'error');
assert.equal(parsed.error, output);
}
}; };
``` ```
@ -308,15 +332,17 @@ async (getUserInput) => {
'..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..'; '..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..';
const output = 'Invalid value'; const output = 'Invalid value';
const coordinate = 'A1'; const coordinate = 'A1';
const value = 'X'; const values = ['0', '10', 'A'];
const data = await fetch(getUserInput('url') + '/api/check', { for (const value of values) {
method: 'POST', const data = await fetch(getUserInput('url') + '/api/check', {
headers: { 'Content-Type': 'application/json' }, method: 'POST',
body: JSON.stringify({ puzzle: input, coordinate, value }) headers: { 'Content-Type': 'application/json' },
}); body: JSON.stringify({ puzzle: input, coordinate, value })
const parsed = await data.json(); });
assert.property(parsed, 'error'); const parsed = await data.json();
assert.equal(parsed.error, output); assert.property(parsed, 'error');
assert.equal(parsed.error, output);
}
}; };
``` ```

View File

@ -32,16 +32,14 @@ Modifica il codice in modo che tutte le variabili siano dichiarate utilizzando `
`var` non dovrebbe esistere nel tuo codice. `var` non dovrebbe esistere nel tuo codice.
```js ```js
(getUserInput) => assert(!getUserInput('index').match(/var/g)); assert.notMatch(code, /var/g);
``` ```
Dovresti cambiare `fCC` a solo maiuscole. Dovresti cambiare `fCC` a solo maiuscole.
```js ```js
(getUserInput) => { assert.match(code, /(FCC)/);
assert(getUserInput('index').match(/(FCC)/)); assert.notMatch(code, /(fCC)/);
assert(!getUserInput('index').match(/fCC/));
}
``` ```
`FCC` dovrebbe essere una variabile costante dichiarata con `const`. `FCC` dovrebbe essere una variabile costante dichiarata con `const`.
@ -54,14 +52,13 @@ assert.match(code, /const\s+FCC/);
`fact` dovrebbe essere dichiarata con `let`. `fact` dovrebbe essere dichiarata con `let`.
```js ```js
(getUserInput) => assert(getUserInput('index').match(/(let fact)/g)); assert.match(code, /(let\s+fact)/g);
``` ```
`console.log` dovrebbe essere cambiato in modo da stampare le variabili `FCC` e `fact`. `console.log` dovrebbe essere cambiato in modo da stampare le variabili `FCC` e `fact`.
```js ```js
(getUserInput) => assert.match(code, /console\.log\(\s*FCC\s*\,\s*fact\s*\)\s*;?/g);
assert(getUserInput('index').match(/console\.log\(\s*FCC\s*\,\s*fact\s*\)\s*;?/g));
``` ```
# --seed-- # --seed--

View File

@ -42,19 +42,19 @@ Aggiorna il codice in modo che utilizzi solo la parola chiave `let`.
`var` non dovrebbe esistere nel codice. `var` non dovrebbe esistere nel codice.
```js ```js
(getUserInput) => assert(!getUserInput('index').match(/var/g)); assert.notMatch(code, /var/g);
``` ```
`catName` dovrebbe essere uguale alla stringa `Oliver`. `catName` dovrebbe essere uguale alla stringa `Oliver`.
```js ```js
assert(catName === 'Oliver'); assert.equal(catName, 'Oliver');
``` ```
`catSound` dovrebbe essere uguale alla stringa `Meow!` `catSound` dovrebbe essere uguale alla stringa `Meow!`
```js ```js
assert(catSound === 'Meow!'); assert.equal(catSound, 'Meow!');
``` ```
# --seed-- # --seed--

View File

@ -129,17 +129,21 @@ Se il rompicapo sottoposto a `/api/solve` ha lunghezza maggiore o minore di 81 c
```js ```js
async (getUserInput) => { async (getUserInput) => {
const input = const inputs = [
'9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..'; '..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6.',
'..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6...'
];
const output = 'Expected puzzle to be 81 characters long'; const output = 'Expected puzzle to be 81 characters long';
const data = await fetch(getUserInput('url') + '/api/solve', { for (const input of inputs) {
method: 'POST', const data = await fetch(getUserInput('url') + '/api/solve', {
headers: { 'Content-Type': 'application/json' }, method: 'POST',
body: JSON.stringify({ puzzle: input }) headers: { 'Content-Type': 'application/json' },
}); body: JSON.stringify({ puzzle: input })
const parsed = await data.json(); });
assert.property(parsed, 'error'); const parsed = await data.json();
assert.equal(parsed.error, output); assert.property(parsed, 'error');
assert.equal(parsed.error, output);
}
}; };
``` ```
@ -246,19 +250,23 @@ Se il rompicapo sottoposto a `/api/check` ha lunghezza maggiore o minore di 81 c
```js ```js
async (getUserInput) => { async (getUserInput) => {
const input = const inputs = [
'9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..'; '..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6.',
'..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6...'
];
const coordinate = 'A1'; const coordinate = 'A1';
const value = '1'; const value = '1';
const output = 'Expected puzzle to be 81 characters long'; const output = 'Expected puzzle to be 81 characters long';
const data = await fetch(getUserInput('url') + '/api/check', { for (const input of inputs) {
method: 'POST', const data = await fetch(getUserInput('url') + '/api/check', {
headers: { 'Content-Type': 'application/json' }, method: 'POST',
body: JSON.stringify({ puzzle: input, coordinate, value }) headers: { 'Content-Type': 'application/json' },
}); body: JSON.stringify({ puzzle: input, coordinate, value })
const parsed = await data.json(); });
assert.property(parsed, 'error'); const parsed = await data.json();
assert.equal(parsed.error, output); assert.property(parsed, 'error');
assert.equal(parsed.error, output);
}
}; };
``` ```
@ -266,17 +274,31 @@ Se all'oggetto sottoposto a `/api/check` manca `puzzle`, `coordinate` o `value`,
```js ```js
async (getUserInput) => { async (getUserInput) => {
const input = const inputs = [
'..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..'; {
const output = 'Required field(s) missing'; puzzle: '..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..',
const data = await fetch(getUserInput('url') + '/api/check', { value: '1',
method: 'POST', },
headers: { 'Content-Type': 'application/json' }, {
body: JSON.stringify({ puzzle: input }) puzzle: '..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..',
}); coordinate: 'A1',
const parsed = await data.json(); },
assert.property(parsed, 'error'); {
assert.equal(parsed.error, output); coordinate: 'A1',
value: '1'
}
];
for (const input of inputs) {
const output = 'Required field(s) missing';
const data = await fetch(getUserInput('url') + '/api/check', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(input)
});
const parsed = await data.json();
assert.property(parsed, 'error');
assert.equal(parsed.error, output);
}
}; };
``` ```
@ -287,16 +309,18 @@ async (getUserInput) => {
const input = const input =
'..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..'; '..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..';
const output = 'Invalid coordinate'; const output = 'Invalid coordinate';
const coordinate = 'XZ18'; const coordinates = ['A0', 'A10', 'J1', 'A', '1', 'XZ18'];
const value = '7'; const value = '7';
const data = await fetch(getUserInput('url') + '/api/check', { for (const coordinate of coordinates) {
method: 'POST', const data = await fetch(getUserInput('url') + '/api/check', {
headers: { 'Content-Type': 'application/json' }, method: 'POST',
body: JSON.stringify({ puzzle: input, coordinate, value }) headers: { 'Content-Type': 'application/json' },
}); body: JSON.stringify({ puzzle: input, coordinate, value })
const parsed = await data.json(); });
assert.property(parsed, 'error'); const parsed = await data.json();
assert.equal(parsed.error, output); assert.property(parsed, 'error');
assert.equal(parsed.error, output);
}
}; };
``` ```
@ -308,15 +332,17 @@ async (getUserInput) => {
'..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..'; '..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..';
const output = 'Invalid value'; const output = 'Invalid value';
const coordinate = 'A1'; const coordinate = 'A1';
const value = 'X'; const values = ['0', '10', 'A'];
const data = await fetch(getUserInput('url') + '/api/check', { for (const value of values) {
method: 'POST', const data = await fetch(getUserInput('url') + '/api/check', {
headers: { 'Content-Type': 'application/json' }, method: 'POST',
body: JSON.stringify({ puzzle: input, coordinate, value }) headers: { 'Content-Type': 'application/json' },
}); body: JSON.stringify({ puzzle: input, coordinate, value })
const parsed = await data.json(); });
assert.property(parsed, 'error'); const parsed = await data.json();
assert.equal(parsed.error, output); assert.property(parsed, 'error');
assert.equal(parsed.error, output);
}
}; };
``` ```

View File

@ -25,39 +25,37 @@ function equalityTest(myVal) {
`myVal``10` と等しい場合には、等価演算子は `true` を返し、中括弧内のコードが実行されて、関数は `Equal` を返します。 それ以外の場合、関数は `Not Equal` を返します。 JavaScript では、比較する 2 つのデータの<dfn>データ型</dfn>が異なる場合 (たとえば `numbers``strings`)、必ず一方の型が他方の型に変換されます。 これを「型強制」と呼びます。 これが行われることで、次のような値の比較が可能になります。 `myVal``10` と等しい場合には、等価演算子は `true` を返し、中括弧内のコードが実行されて、関数は `Equal` を返します。 それ以外の場合、関数は `Not Equal` を返します。 JavaScript では、比較する 2 つのデータの<dfn>データ型</dfn>が異なる場合 (たとえば `numbers``strings`)、必ず一方の型が他方の型に変換されます。 これを「型強制」と呼びます。 これが行われることで、次のような値の比較が可能になります。
```js ```js
1 == 1 1 == 1 // true
1 == 2 1 == 2 // false
1 == '1' 1 == '1' // true
"3" == 3 "3" == 3 // true
``` ```
これらの式は上から順に、`true``false``true``true` と評価されます。
# --instructions-- # --instructions--
`val``12` と等しい場合に関数が文字列 `Equal` を返すように、指定された行に等価演算子を追加してください。 Add the equality operator to the indicated line so that the function will return the string `Equal` when `val` is equivalent to `12`.
# --hints-- # --hints--
`testEqual(10)` は文字列 `Not Equal` を返す必要があります。 `testEqual(10)` should return the string `Not Equal`
```js ```js
assert(testEqual(10) === 'Not Equal'); assert(testEqual(10) === 'Not Equal');
``` ```
`testEqual(12)` は文字列 `Equal` を返す必要があります。 `testEqual(12)` should return the string `Equal`
```js ```js
assert(testEqual(12) === 'Equal'); assert(testEqual(12) === 'Equal');
``` ```
`testEqual("12")` は文字列 `Equal` を返す必要があります。 `testEqual("12")` should return the string `Equal`
```js ```js
assert(testEqual('12') === 'Equal'); assert(testEqual('12') === 'Equal');
``` ```
`==` 演算子を使用してください。 You should use the `==` operator
```js ```js
assert(code.match(/==/g) && !code.match(/===/g)); assert(code.match(/==/g) && !code.match(/===/g));

View File

@ -16,63 +16,61 @@ dashedName: comparison-with-the-greater-than-operator
**例** **例**
```js ```js
5 > 3 5 > 3 // true
7 > '3' 7 > '3' // true
2 > 3 2 > 3 // false
'1' > 9 '1' > 9 // false
``` ```
これらの式は上から順に、`true``true``false``false` と評価されます。
# --instructions-- # --instructions--
return ステートメントの意味が正しくなるように、指定された行に大なり演算子を追加してください。 Add the greater than operator to the indicated lines so that the return statements make sense.
# --hints-- # --hints--
`testGreaterThan(0)` は文字列 `10 or Under` を返す必要があります。 `testGreaterThan(0)` should return the string `10 or Under`
```js ```js
assert(testGreaterThan(0) === '10 or Under'); assert(testGreaterThan(0) === '10 or Under');
``` ```
`testGreaterThan(10)` は文字列 `10 or Under` を返す必要があります。 `testGreaterThan(10)` should return the string `10 or Under`
```js ```js
assert(testGreaterThan(10) === '10 or Under'); assert(testGreaterThan(10) === '10 or Under');
``` ```
`testGreaterThan(11)` は文字列 `Over 10` を返す必要があります。 `testGreaterThan(11)` should return the string `Over 10`
```js ```js
assert(testGreaterThan(11) === 'Over 10'); assert(testGreaterThan(11) === 'Over 10');
``` ```
`testGreaterThan(99)` は文字列 `Over 10` を返す必要があります。 `testGreaterThan(99)` should return the string `Over 10`
```js ```js
assert(testGreaterThan(99) === 'Over 10'); assert(testGreaterThan(99) === 'Over 10');
``` ```
`testGreaterThan(100)` は文字列 `Over 10` を返す必要があります。 `testGreaterThan(100)` should return the string `Over 10`
```js ```js
assert(testGreaterThan(100) === 'Over 10'); assert(testGreaterThan(100) === 'Over 10');
``` ```
`testGreaterThan(101)` は文字列 `Over 100` を返す必要があります。 `testGreaterThan(101)` should return the string `Over 100`
```js ```js
assert(testGreaterThan(101) === 'Over 100'); assert(testGreaterThan(101) === 'Over 100');
``` ```
`testGreaterThan(150)` は文字列 `Over 100` を返す必要があります。 `testGreaterThan(150)` should return the string `Over 100`
```js ```js
assert(testGreaterThan(150) === 'Over 100'); assert(testGreaterThan(150) === 'Over 100');
``` ```
`>` 演算子を 2 回以上使用してください。 You should use the `>` operator at least twice
```js ```js
assert(code.match(/val\s*>\s*('|")*\d+('|")*/g).length > 1); assert(code.match(/val\s*>\s*('|")*\d+('|")*/g).length > 1);

View File

@ -16,63 +16,61 @@ dashedName: comparison-with-the-greater-than-or-equal-to-operator
**例** **例**
```js ```js
6 >= 6 6 >= 6 // true
7 >= '3' 7 >= '3' // true
2 >= 3 2 >= 3 // false
'7' >= 9 '7' >= 9 // false
``` ```
これらの式は上から順に、`true``true``false``false` と評価されます。
# --instructions-- # --instructions--
return ステートメントの意味が正しくなるように、指定された行に大なりイコール演算子を追加してください。 Add the greater than or equal to operator to the indicated lines so that the return statements make sense.
# --hints-- # --hints--
`testGreaterOrEqual(0)` は文字列 `Less than 10` を返す必要があります。 `testGreaterOrEqual(0)` should return the string `Less than 10`
```js ```js
assert(testGreaterOrEqual(0) === 'Less than 10'); assert(testGreaterOrEqual(0) === 'Less than 10');
``` ```
`testGreaterOrEqual(9)` は文字列 `Less than 10` を返す必要があります。 `testGreaterOrEqual(9)` should return the string `Less than 10`
```js ```js
assert(testGreaterOrEqual(9) === 'Less than 10'); assert(testGreaterOrEqual(9) === 'Less than 10');
``` ```
`testGreaterOrEqual(10)` は文字列 `10 or Over` を返す必要があります。 `testGreaterOrEqual(10)` should return the string `10 or Over`
```js ```js
assert(testGreaterOrEqual(10) === '10 or Over'); assert(testGreaterOrEqual(10) === '10 or Over');
``` ```
`testGreaterOrEqual(11)` は文字列 `10 or Over` を返す必要があります。 `testGreaterOrEqual(11)` should return the string `10 or Over`
```js ```js
assert(testGreaterOrEqual(11) === '10 or Over'); assert(testGreaterOrEqual(11) === '10 or Over');
``` ```
`testGreaterOrEqual(19)` は文字列 `10 or Over` を返す必要があります。 `testGreaterOrEqual(19)` should return the string `10 or Over`
```js ```js
assert(testGreaterOrEqual(19) === '10 or Over'); assert(testGreaterOrEqual(19) === '10 or Over');
``` ```
`testGreaterOrEqual(100)` は文字列 `20 or Over` を返す必要があります。 `testGreaterOrEqual(100)` should return the string `20 or Over`
```js ```js
assert(testGreaterOrEqual(100) === '20 or Over'); assert(testGreaterOrEqual(100) === '20 or Over');
``` ```
`testGreaterOrEqual(21)` は文字列 `20 or Over` を返す必要があります。 `testGreaterOrEqual(21)` should return the string `20 or Over`
```js ```js
assert(testGreaterOrEqual(21) === '20 or Over'); assert(testGreaterOrEqual(21) === '20 or Over');
``` ```
`>=` 演算子を 2 回以上使用してください。 You should use the `>=` operator at least twice
```js ```js
assert(code.match(/val\s*>=\s*('|")*\d+('|")*/g).length > 1); assert(code.match(/val\s*>=\s*('|")*\d+('|")*/g).length > 1);

View File

@ -14,52 +14,50 @@ dashedName: comparison-with-the-inequality-operator
**例** **例**
```js ```js
1 != 2 1 != 2 // true
1 != "1" 1 != "1" // false
1 != '1' 1 != '1' // false
1 != true 1 != true // false
0 != false 0 != false // false
``` ```
これらの式は上から順に、`true``false``false``false``false` と評価されます。
# --instructions-- # --instructions--
`val` `99` と等しくない場合に関数が文字列 `Not Equal` を返すように、`if` ステートメントに不等価演算子 `!=` を追加してください。 Add the inequality operator `!=` in the `if` statement so that the function will return the string `Not Equal` when `val` is not equivalent to `99`.
# --hints-- # --hints--
`testNotEqual(99)` は文字列 `Equal` を返す必要があります。 `testNotEqual(99)` should return the string `Equal`
```js ```js
assert(testNotEqual(99) === 'Equal'); assert(testNotEqual(99) === 'Equal');
``` ```
`testNotEqual("99")` は文字列 `Equal` を返す必要があります。 `testNotEqual("99")` should return the string `Equal`
```js ```js
assert(testNotEqual('99') === 'Equal'); assert(testNotEqual('99') === 'Equal');
``` ```
`testNotEqual(12)` は文字列 `Not Equal` を返す必要があります。 `testNotEqual(12)` should return the string `Not Equal`
```js ```js
assert(testNotEqual(12) === 'Not Equal'); assert(testNotEqual(12) === 'Not Equal');
``` ```
`testNotEqual("12")` は文字列 `Not Equal` を返す必要があります。 `testNotEqual("12")` should return the string `Not Equal`
```js ```js
assert(testNotEqual('12') === 'Not Equal'); assert(testNotEqual('12') === 'Not Equal');
``` ```
`testNotEqual("bob")` は文字列 `Not Equal` を返す必要があります。 `testNotEqual("bob")` should return the string `Not Equal`
```js ```js
assert(testNotEqual('bob') === 'Not Equal'); assert(testNotEqual('bob') === 'Not Equal');
``` ```
`!=` 演算子を使用してください。 You should use the `!=` operator
```js ```js
assert(code.match(/(?!!==)!=/)); assert(code.match(/(?!!==)!=/));

View File

@ -14,58 +14,56 @@ dashedName: comparison-with-the-less-than-operator
**例** **例**
```js ```js
2 < 5 2 < 5 // true
'3' < 7 '3' < 7 // true
5 < 5 5 < 5 // false
3 < 2 3 < 2 // false
'8' < 4 '8' < 4 // false
``` ```
これらの式は上から順に、`true``true``false``false``false` と評価されます。
# --instructions-- # --instructions--
return ステートメントの意味が正しくなるように、指定された行に小なり演算子を追加してください。 Add the less than operator to the indicated lines so that the return statements make sense.
# --hints-- # --hints--
`testLessThan(0)` は文字列 `Under 25` を返す必要があります。 `testLessThan(0)` should return the string `Under 25`
```js ```js
assert(testLessThan(0) === 'Under 25'); assert(testLessThan(0) === 'Under 25');
``` ```
`testLessThan(24)` は文字列 `Under 25` を返す必要があります。 `testLessThan(24)` should return the string `Under 25`
```js ```js
assert(testLessThan(24) === 'Under 25'); assert(testLessThan(24) === 'Under 25');
``` ```
`testLessThan(25)` は文字列 `Under 55` を返す必要があります。 `testLessThan(25)` should return the string `Under 55`
```js ```js
assert(testLessThan(25) === 'Under 55'); assert(testLessThan(25) === 'Under 55');
``` ```
`testLessThan(54)` は文字列 `Under 55` を返す必要があります。 `testLessThan(54)` should return the string `Under 55`
```js ```js
assert(testLessThan(54) === 'Under 55'); assert(testLessThan(54) === 'Under 55');
``` ```
`testLessThan(55)` は文字列 `55 or Over` を返す必要があります。 `testLessThan(55)` should return the string `55 or Over`
```js ```js
assert(testLessThan(55) === '55 or Over'); assert(testLessThan(55) === '55 or Over');
``` ```
`testLessThan(99)` は文字列 `55 or Over` を返す必要があります。 `testLessThan(99)` should return the string `55 or Over`
```js ```js
assert(testLessThan(99) === '55 or Over'); assert(testLessThan(99) === '55 or Over');
``` ```
`<` 演算子を 2 回以上使用してください。 You should use the `<` operator at least twice
```js ```js
assert(code.match(/val\s*<\s*('|")*\d+('|")*/g).length > 1); assert(code.match(/val\s*<\s*('|")*\d+('|")*/g).length > 1);

View File

@ -14,64 +14,62 @@ dashedName: comparison-with-the-less-than-or-equal-to-operator
**例** **例**
```js ```js
4 <= 5 4 <= 5 // true
'7' <= 7 '7' <= 7 // true
5 <= 5 5 <= 5 // true
3 <= 2 3 <= 2 // false
'8' <= 4 '8' <= 4 // false
``` ```
これらの式は上から順に、`true``true``true``false``false` と評価されます。
# --instructions-- # --instructions--
return ステートメントの意味が正しくなるように、指定された行に小なりイコール演算子を追加してください。 Add the less than or equal to operator to the indicated lines so that the return statements make sense.
# --hints-- # --hints--
`testLessOrEqual(0)` は文字列 `Smaller Than or Equal to 12` を返す必要があります。 `testLessOrEqual(0)` should return the string `Smaller Than or Equal to 12`
```js ```js
assert(testLessOrEqual(0) === 'Smaller Than or Equal to 12'); assert(testLessOrEqual(0) === 'Smaller Than or Equal to 12');
``` ```
`testLessOrEqual(11)` は文字列 `Smaller Than or Equal to 12` を返す必要があります。 `testLessOrEqual(11)` should return the string `Smaller Than or Equal to 12`
```js ```js
assert(testLessOrEqual(11) === 'Smaller Than or Equal to 12'); assert(testLessOrEqual(11) === 'Smaller Than or Equal to 12');
``` ```
`testLessOrEqual(12)` は文字列 `Smaller Than or Equal to 12` を返す必要があります。 `testLessOrEqual(12)` should return the string `Smaller Than or Equal to 12`
```js ```js
assert(testLessOrEqual(12) === 'Smaller Than or Equal to 12'); assert(testLessOrEqual(12) === 'Smaller Than or Equal to 12');
``` ```
`testLessOrEqual(23)` は文字列 `Smaller Than or Equal to 24` を返す必要があります。 `testLessOrEqual(23)` should return the string `Smaller Than or Equal to 24`
```js ```js
assert(testLessOrEqual(23) === 'Smaller Than or Equal to 24'); assert(testLessOrEqual(23) === 'Smaller Than or Equal to 24');
``` ```
`testLessOrEqual(24)` は文字列 `Smaller Than or Equal to 24` を返す必要があります。 `testLessOrEqual(24)` should return the string `Smaller Than or Equal to 24`
```js ```js
assert(testLessOrEqual(24) === 'Smaller Than or Equal to 24'); assert(testLessOrEqual(24) === 'Smaller Than or Equal to 24');
``` ```
`testLessOrEqual(25)` は文字列 `More Than 24` を返す必要があります。 `testLessOrEqual(25)` should return the string `More Than 24`
```js ```js
assert(testLessOrEqual(25) === 'More Than 24'); assert(testLessOrEqual(25) === 'More Than 24');
``` ```
`testLessOrEqual(55)` は文字列 `More Than 24` を返す必要があります。 `testLessOrEqual(55)` should return the string `More Than 24`
```js ```js
assert(testLessOrEqual(55) === 'More Than 24'); assert(testLessOrEqual(55) === 'More Than 24');
``` ```
`<=` 演算子を 2 回以上使用してください。 You should use the `<=` operator at least twice
```js ```js
assert(code.match(/val\s*<=\s*('|")*\d+('|")*/g).length > 1); assert(code.match(/val\s*<=\s*('|")*\d+('|")*/g).length > 1);

View File

@ -16,39 +16,37 @@ dashedName: comparison-with-the-strict-equality-operator
**例** **例**
```js ```js
3 === 3 3 === 3 // true
3 === '3' 3 === '3' // false
``` ```
これらの条件ではそれぞれ、`true``false` を返すことになります。 In the second example, `3` is a `Number` type and `'3'` is a `String` type.
2 番目の例では、 `3``Number` 型で、 `'3'``String` 型です。
# --instructions-- # --instructions--
`if` ステートメントで厳密等価演算子を使用して、`val``7` と厳密に等しい場合に関数が文字列 `Equal` を返すようにしてください。 Use the strict equality operator in the `if` statement so the function will return the string `Equal` when `val` is strictly equal to `7`.
# --hints-- # --hints--
`testStrict(10)` は文字列 `Not Equal` を返す必要があります。 `testStrict(10)` should return the string `Not Equal`
```js ```js
assert(testStrict(10) === 'Not Equal'); assert(testStrict(10) === 'Not Equal');
``` ```
`testStrict(7)` は文字列 `Equal` を返す必要があります。 `testStrict(7)` should return the string `Equal`
```js ```js
assert(testStrict(7) === 'Equal'); assert(testStrict(7) === 'Equal');
``` ```
`testStrict("7")` は文字列 `Not Equal` を返す必要があります。 `testStrict("7")` should return the string `Not Equal`
```js ```js
assert(testStrict('7') === 'Not Equal'); assert(testStrict('7') === 'Not Equal');
``` ```
`===` 演算子を使用してください。 You should use the `===` operator
```js ```js
assert(code.match(/(val\s*===\s*\d+)|(\d+\s*===\s*val)/g).length > 0); assert(code.match(/(val\s*===\s*\d+)|(\d+\s*===\s*val)/g).length > 0);

View File

@ -14,44 +14,42 @@ dashedName: comparison-with-the-strict-inequality-operator
**例** **例**
```js ```js
3 !== 3 3 !== 3 // false
3 !== '3' 3 !== '3' // true
4 !== 3 4 !== 3 // true
``` ```
これらの式は順に `false``true``true` と評価されます。
# --instructions-- # --instructions--
`val` `17` と厳密に等しくない場合に関数が文字列 `Not Equal` を返すように、`if` ステートメントに厳密不等価演算子を追加してください。 Add the strict inequality operator to the `if` statement so the function will return the string `Not Equal` when `val` is not strictly equal to `17`
# --hints-- # --hints--
`testStrictNotEqual(17)` は文字列 `Equal` を返す必要があります。 `testStrictNotEqual(17)` should return the string `Equal`
```js ```js
assert(testStrictNotEqual(17) === 'Equal'); assert(testStrictNotEqual(17) === 'Equal');
``` ```
`testStrictNotEqual("17")` は文字列 `Not Equal` を返す必要があります。 `testStrictNotEqual("17")` should return the string `Not Equal`
```js ```js
assert(testStrictNotEqual('17') === 'Not Equal'); assert(testStrictNotEqual('17') === 'Not Equal');
``` ```
`testStrictNotEqual(12)` は文字列 `Not Equal` を返す必要があります。 `testStrictNotEqual(12)` should return the string `Not Equal`
```js ```js
assert(testStrictNotEqual(12) === 'Not Equal'); assert(testStrictNotEqual(12) === 'Not Equal');
``` ```
`testStrictNotEqual("bob")` は文字列 `Not Equal` を返す必要があります。 `testStrictNotEqual("bob")` should return the string `Not Equal`
```js ```js
assert(testStrictNotEqual('bob') === 'Not Equal'); assert(testStrictNotEqual('bob') === 'Not Equal');
``` ```
`!==` 演算子を使用してください。 You should use the `!==` operator
```js ```js
assert(code.match(/(val\s*!==\s*\d+)|(\d+\s*!==\s*val)/g).length > 0); assert(code.match(/(val\s*!==\s*\d+)|(\d+\s*!==\s*val)/g).length > 0);

View File

@ -32,16 +32,14 @@ FAV_PET = "Dogs";
`var` がコード内に存在しないようにしてください。 `var` がコード内に存在しないようにしてください。
```js ```js
(getUserInput) => assert(!getUserInput('index').match(/var/g)); assert.notMatch(code, /var/g);
``` ```
`fCC` をすべて大文字に変更する必要があります。 `fCC` をすべて大文字に変更する必要があります。
```js ```js
(getUserInput) => { assert.match(code, /(FCC)/);
assert(getUserInput('index').match(/(FCC)/)); assert.notMatch(code, /(fCC)/);
assert(!getUserInput('index').match(/fCC/));
}
``` ```
`FCC``const` で宣言された定数変数である必要があります。 `FCC``const` で宣言された定数変数である必要があります。
@ -54,14 +52,13 @@ assert.match(code, /const\s+FCC/);
`fact``let` を使用して宣言する必要があります。 `fact``let` を使用して宣言する必要があります。
```js ```js
(getUserInput) => assert(getUserInput('index').match(/(let fact)/g)); assert.match(code, /(let\s+fact)/g);
``` ```
`console.log` を、`FCC``fact` 変数が出力されるように変更する必要があります。 `console.log` を、`FCC``fact` 変数が出力されるように変更する必要があります。
```js ```js
(getUserInput) => assert.match(code, /console\.log\(\s*FCC\s*\,\s*fact\s*\)\s*;?/g);
assert(getUserInput('index').match(/console\.log\(\s*FCC\s*\,\s*fact\s*\)\s*;?/g));
``` ```
# --seed-- # --seed--

View File

@ -42,19 +42,19 @@ let camper = "David";
`var` がコード内に存在しない必要があります。 `var` がコード内に存在しない必要があります。
```js ```js
(getUserInput) => assert(!getUserInput('index').match(/var/g)); assert.notMatch(code, /var/g);
``` ```
`catName` は文字列 `Oliver` である必要があります。 `catName` は文字列 `Oliver` である必要があります。
```js ```js
assert(catName === 'Oliver'); assert.equal(catName, 'Oliver');
``` ```
`catSound` は文字列 `Meow!` である必要があります。 `catSound` は文字列 `Meow!` である必要があります。
```js ```js
assert(catSound === 'Meow!'); assert.equal(catSound, 'Meow!');
``` ```
# --seed-- # --seed--

View File

@ -129,17 +129,21 @@ async (getUserInput) => {
```js ```js
async (getUserInput) => { async (getUserInput) => {
const input = const inputs = [
'9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..'; '..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6.',
'..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6...'
];
const output = 'Expected puzzle to be 81 characters long'; const output = 'Expected puzzle to be 81 characters long';
const data = await fetch(getUserInput('url') + '/api/solve', { for (const input of inputs) {
method: 'POST', const data = await fetch(getUserInput('url') + '/api/solve', {
headers: { 'Content-Type': 'application/json' }, method: 'POST',
body: JSON.stringify({ puzzle: input }) headers: { 'Content-Type': 'application/json' },
}); body: JSON.stringify({ puzzle: input })
const parsed = await data.json(); });
assert.property(parsed, 'error'); const parsed = await data.json();
assert.equal(parsed.error, output); assert.property(parsed, 'error');
assert.equal(parsed.error, output);
}
}; };
``` ```
@ -246,19 +250,23 @@ async (getUserInput) => {
```js ```js
async (getUserInput) => { async (getUserInput) => {
const input = const inputs = [
'9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..'; '..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6.',
'..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6...'
];
const coordinate = 'A1'; const coordinate = 'A1';
const value = '1'; const value = '1';
const output = 'Expected puzzle to be 81 characters long'; const output = 'Expected puzzle to be 81 characters long';
const data = await fetch(getUserInput('url') + '/api/check', { for (const input of inputs) {
method: 'POST', const data = await fetch(getUserInput('url') + '/api/check', {
headers: { 'Content-Type': 'application/json' }, method: 'POST',
body: JSON.stringify({ puzzle: input, coordinate, value }) headers: { 'Content-Type': 'application/json' },
}); body: JSON.stringify({ puzzle: input, coordinate, value })
const parsed = await data.json(); });
assert.property(parsed, 'error'); const parsed = await data.json();
assert.equal(parsed.error, output); assert.property(parsed, 'error');
assert.equal(parsed.error, output);
}
}; };
``` ```
@ -266,17 +274,31 @@ async (getUserInput) => {
```js ```js
async (getUserInput) => { async (getUserInput) => {
const input = const inputs = [
'..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..'; {
const output = 'Required field(s) missing'; puzzle: '..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..',
const data = await fetch(getUserInput('url') + '/api/check', { value: '1',
method: 'POST', },
headers: { 'Content-Type': 'application/json' }, {
body: JSON.stringify({ puzzle: input }) puzzle: '..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..',
}); coordinate: 'A1',
const parsed = await data.json(); },
assert.property(parsed, 'error'); {
assert.equal(parsed.error, output); coordinate: 'A1',
value: '1'
}
];
for (const input of inputs) {
const output = 'Required field(s) missing';
const data = await fetch(getUserInput('url') + '/api/check', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(input)
});
const parsed = await data.json();
assert.property(parsed, 'error');
assert.equal(parsed.error, output);
}
}; };
``` ```
@ -287,16 +309,18 @@ async (getUserInput) => {
const input = const input =
'..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..'; '..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..';
const output = 'Invalid coordinate'; const output = 'Invalid coordinate';
const coordinate = 'XZ18'; const coordinates = ['A0', 'A10', 'J1', 'A', '1', 'XZ18'];
const value = '7'; const value = '7';
const data = await fetch(getUserInput('url') + '/api/check', { for (const coordinate of coordinates) {
method: 'POST', const data = await fetch(getUserInput('url') + '/api/check', {
headers: { 'Content-Type': 'application/json' }, method: 'POST',
body: JSON.stringify({ puzzle: input, coordinate, value }) headers: { 'Content-Type': 'application/json' },
}); body: JSON.stringify({ puzzle: input, coordinate, value })
const parsed = await data.json(); });
assert.property(parsed, 'error'); const parsed = await data.json();
assert.equal(parsed.error, output); assert.property(parsed, 'error');
assert.equal(parsed.error, output);
}
}; };
``` ```
@ -308,15 +332,17 @@ async (getUserInput) => {
'..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..'; '..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..';
const output = 'Invalid value'; const output = 'Invalid value';
const coordinate = 'A1'; const coordinate = 'A1';
const value = 'X'; const values = ['0', '10', 'A'];
const data = await fetch(getUserInput('url') + '/api/check', { for (const value of values) {
method: 'POST', const data = await fetch(getUserInput('url') + '/api/check', {
headers: { 'Content-Type': 'application/json' }, method: 'POST',
body: JSON.stringify({ puzzle: input, coordinate, value }) headers: { 'Content-Type': 'application/json' },
}); body: JSON.stringify({ puzzle: input, coordinate, value })
const parsed = await data.json(); });
assert.property(parsed, 'error'); const parsed = await data.json();
assert.equal(parsed.error, output); assert.property(parsed, 'error');
assert.equal(parsed.error, output);
}
}; };
``` ```

View File

@ -9,7 +9,7 @@ dashedName: build-a-boilerplate
# --description-- # --description--
この 170 のレッスンコースでは、コマンドラインのみを使用してウェブサイトのボイラープレートを作成することで、基本のコマンドについて学習します。 この 170 のレッスンから成るコースでは、コマンドラインのみを使用してウェブサイトのボイラープレートを作成することで、基本のコマンドについて学習します。
# --instructions-- # --instructions--

View File

@ -32,16 +32,14 @@ Altere o código para que todas as variáveis sejam declaradas usando `let` ou `
`var` não deve existir no código. `var` não deve existir no código.
```js ```js
(getUserInput) => assert(!getUserInput('index').match(/var/g)); assert.notMatch(code, /var/g);
``` ```
Você deve alterar `fCC` para uma string toda em letras maiúsculas. Você deve alterar `fCC` para uma string toda em letras maiúsculas.
```js ```js
(getUserInput) => { assert.match(code, /(FCC)/);
assert(getUserInput('index').match(/(FCC)/)); assert.notMatch(code, /(fCC)/);
assert(!getUserInput('index').match(/fCC/));
}
``` ```
`FCC` deve ser uma variável constante declarada com `const`. `FCC` deve ser uma variável constante declarada com `const`.
@ -54,14 +52,13 @@ assert.match(code, /const\s+FCC/);
A variável `fact` deve ser declarada com `let`. A variável `fact` deve ser declarada com `let`.
```js ```js
(getUserInput) => assert(getUserInput('index').match(/(let fact)/g)); assert.match(code, /(let\s+fact)/g);
``` ```
`console.log` deve ser alterado para imprimir as variáveis `FCC` e `fact`. `console.log` deve ser alterado para imprimir as variáveis `FCC` e `fact`.
```js ```js
(getUserInput) => assert.match(code, /console\.log\(\s*FCC\s*\,\s*fact\s*\)\s*;?/g);
assert(getUserInput('index').match(/console\.log\(\s*FCC\s*\,\s*fact\s*\)\s*;?/g));
``` ```
# --seed-- # --seed--

View File

@ -42,19 +42,19 @@ Atualize o código para que apenas a palavra-chave `let` seja usada.
A palavra-chave `var` não deve existir no código. A palavra-chave `var` não deve existir no código.
```js ```js
(getUserInput) => assert(!getUserInput('index').match(/var/g)); assert.notMatch(code, /var/g);
``` ```
A variável `catName` deve ser uma string de valor `Oliver`. A variável `catName` deve ser uma string de valor `Oliver`.
```js ```js
assert(catName === 'Oliver'); assert.equal(catName, 'Oliver');
``` ```
`catSound` deve ser uma string de valor `Meow!` `catSound` deve ser uma string de valor `Meow!`
```js ```js
assert(catSound === 'Meow!'); assert.equal(catSound, 'Meow!');
``` ```
# --seed-- # --seed--

View File

@ -129,17 +129,21 @@ Se o desafio enviado a `/api/solve` é maior ou menor que 81 caracteres, o valor
```js ```js
async (getUserInput) => { async (getUserInput) => {
const input = const inputs = [
'9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..'; '..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6.',
'..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6...'
];
const output = 'Expected puzzle to be 81 characters long'; const output = 'Expected puzzle to be 81 characters long';
const data = await fetch(getUserInput('url') + '/api/solve', { for (const input of inputs) {
method: 'POST', const data = await fetch(getUserInput('url') + '/api/solve', {
headers: { 'Content-Type': 'application/json' }, method: 'POST',
body: JSON.stringify({ puzzle: input }) headers: { 'Content-Type': 'application/json' },
}); body: JSON.stringify({ puzzle: input })
const parsed = await data.json(); });
assert.property(parsed, 'error'); const parsed = await data.json();
assert.equal(parsed.error, output); assert.property(parsed, 'error');
assert.equal(parsed.error, output);
}
}; };
``` ```
@ -246,19 +250,23 @@ Se o desafio enviado a `/api/check` é maior ou menor que 81 caracteres, o valor
```js ```js
async (getUserInput) => { async (getUserInput) => {
const input = const inputs = [
'9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..'; '..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6.',
'..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6...'
];
const coordinate = 'A1'; const coordinate = 'A1';
const value = '1'; const value = '1';
const output = 'Expected puzzle to be 81 characters long'; const output = 'Expected puzzle to be 81 characters long';
const data = await fetch(getUserInput('url') + '/api/check', { for (const input of inputs) {
method: 'POST', const data = await fetch(getUserInput('url') + '/api/check', {
headers: { 'Content-Type': 'application/json' }, method: 'POST',
body: JSON.stringify({ puzzle: input, coordinate, value }) headers: { 'Content-Type': 'application/json' },
}); body: JSON.stringify({ puzzle: input, coordinate, value })
const parsed = await data.json(); });
assert.property(parsed, 'error'); const parsed = await data.json();
assert.equal(parsed.error, output); assert.property(parsed, 'error');
assert.equal(parsed.error, output);
}
}; };
``` ```
@ -266,17 +274,31 @@ Se o objeto enviado a `/api/check` estiver com `puzzle`, `coordinate` ou `value`
```js ```js
async (getUserInput) => { async (getUserInput) => {
const input = const inputs = [
'..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..'; {
const output = 'Required field(s) missing'; puzzle: '..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..',
const data = await fetch(getUserInput('url') + '/api/check', { value: '1',
method: 'POST', },
headers: { 'Content-Type': 'application/json' }, {
body: JSON.stringify({ puzzle: input }) puzzle: '..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..',
}); coordinate: 'A1',
const parsed = await data.json(); },
assert.property(parsed, 'error'); {
assert.equal(parsed.error, output); coordinate: 'A1',
value: '1'
}
];
for (const input of inputs) {
const output = 'Required field(s) missing';
const data = await fetch(getUserInput('url') + '/api/check', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(input)
});
const parsed = await data.json();
assert.property(parsed, 'error');
assert.equal(parsed.error, output);
}
}; };
``` ```
@ -287,16 +309,18 @@ async (getUserInput) => {
const input = const input =
'..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..'; '..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..';
const output = 'Invalid coordinate'; const output = 'Invalid coordinate';
const coordinate = 'XZ18'; const coordinates = ['A0', 'A10', 'J1', 'A', '1', 'XZ18'];
const value = '7'; const value = '7';
const data = await fetch(getUserInput('url') + '/api/check', { for (const coordinate of coordinates) {
method: 'POST', const data = await fetch(getUserInput('url') + '/api/check', {
headers: { 'Content-Type': 'application/json' }, method: 'POST',
body: JSON.stringify({ puzzle: input, coordinate, value }) headers: { 'Content-Type': 'application/json' },
}); body: JSON.stringify({ puzzle: input, coordinate, value })
const parsed = await data.json(); });
assert.property(parsed, 'error'); const parsed = await data.json();
assert.equal(parsed.error, output); assert.property(parsed, 'error');
assert.equal(parsed.error, output);
}
}; };
``` ```
@ -308,15 +332,17 @@ async (getUserInput) => {
'..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..'; '..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..';
const output = 'Invalid value'; const output = 'Invalid value';
const coordinate = 'A1'; const coordinate = 'A1';
const value = 'X'; const values = ['0', '10', 'A'];
const data = await fetch(getUserInput('url') + '/api/check', { for (const value of values) {
method: 'POST', const data = await fetch(getUserInput('url') + '/api/check', {
headers: { 'Content-Type': 'application/json' }, method: 'POST',
body: JSON.stringify({ puzzle: input, coordinate, value }) headers: { 'Content-Type': 'application/json' },
}); body: JSON.stringify({ puzzle: input, coordinate, value })
const parsed = await data.json(); });
assert.property(parsed, 'error'); const parsed = await data.json();
assert.equal(parsed.error, output); assert.property(parsed, 'error');
assert.equal(parsed.error, output);
}
}; };
``` ```

View File

@ -42,19 +42,19 @@ let camper = "David";
`var` має бути відсутнім у коді. `var` має бути відсутнім у коді.
```js ```js
(getUserInput) => assert(!getUserInput('index').match(/var/g)); assert.notMatch(code, /var/g);
``` ```
`catName` має бути рядком `Oliver`. `catName` має бути рядком `Oliver`.
```js ```js
assert(catName === 'Oliver'); assert.equal(catName, 'Oliver');
``` ```
`catSound` має бути рядком `Meow!` `catSound` має бути рядком `Meow!`
```js ```js
assert(catSound === 'Meow!'); assert.equal(catSound, 'Meow!');
``` ```
# --seed-- # --seed--

View File

@ -129,17 +129,21 @@ async (getUserInput) => {
```js ```js
async (getUserInput) => { async (getUserInput) => {
const input = const inputs = [
'9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..'; '..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6.',
'..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6...'
];
const output = 'Expected puzzle to be 81 characters long'; const output = 'Expected puzzle to be 81 characters long';
const data = await fetch(getUserInput('url') + '/api/solve', { for (const input of inputs) {
method: 'POST', const data = await fetch(getUserInput('url') + '/api/solve', {
headers: { 'Content-Type': 'application/json' }, method: 'POST',
body: JSON.stringify({ puzzle: input }) headers: { 'Content-Type': 'application/json' },
}); body: JSON.stringify({ puzzle: input })
const parsed = await data.json(); });
assert.property(parsed, 'error'); const parsed = await data.json();
assert.equal(parsed.error, output); assert.property(parsed, 'error');
assert.equal(parsed.error, output);
}
}; };
``` ```
@ -246,19 +250,23 @@ async (getUserInput) => {
```js ```js
async (getUserInput) => { async (getUserInput) => {
const input = const inputs = [
'9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..'; '..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6.',
'..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6...'
];
const coordinate = 'A1'; const coordinate = 'A1';
const value = '1'; const value = '1';
const output = 'Expected puzzle to be 81 characters long'; const output = 'Expected puzzle to be 81 characters long';
const data = await fetch(getUserInput('url') + '/api/check', { for (const input of inputs) {
method: 'POST', const data = await fetch(getUserInput('url') + '/api/check', {
headers: { 'Content-Type': 'application/json' }, method: 'POST',
body: JSON.stringify({ puzzle: input, coordinate, value }) headers: { 'Content-Type': 'application/json' },
}); body: JSON.stringify({ puzzle: input, coordinate, value })
const parsed = await data.json(); });
assert.property(parsed, 'error'); const parsed = await data.json();
assert.equal(parsed.error, output); assert.property(parsed, 'error');
assert.equal(parsed.error, output);
}
}; };
``` ```
@ -266,17 +274,31 @@ async (getUserInput) => {
```js ```js
async (getUserInput) => { async (getUserInput) => {
const input = const inputs = [
'..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..'; {
const output = 'Required field(s) missing'; puzzle: '..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..',
const data = await fetch(getUserInput('url') + '/api/check', { value: '1',
method: 'POST', },
headers: { 'Content-Type': 'application/json' }, {
body: JSON.stringify({ puzzle: input }) puzzle: '..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..',
}); coordinate: 'A1',
const parsed = await data.json(); },
assert.property(parsed, 'error'); {
assert.equal(parsed.error, output); coordinate: 'A1',
value: '1'
}
];
for (const input of inputs) {
const output = 'Required field(s) missing';
const data = await fetch(getUserInput('url') + '/api/check', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(input)
});
const parsed = await data.json();
assert.property(parsed, 'error');
assert.equal(parsed.error, output);
}
}; };
``` ```
@ -287,16 +309,18 @@ async (getUserInput) => {
const input = const input =
'..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..'; '..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..';
const output = 'Invalid coordinate'; const output = 'Invalid coordinate';
const coordinate = 'XZ18'; const coordinates = ['A0', 'A10', 'J1', 'A', '1', 'XZ18'];
const value = '7'; const value = '7';
const data = await fetch(getUserInput('url') + '/api/check', { for (const coordinate of coordinates) {
method: 'POST', const data = await fetch(getUserInput('url') + '/api/check', {
headers: { 'Content-Type': 'application/json' }, method: 'POST',
body: JSON.stringify({ puzzle: input, coordinate, value }) headers: { 'Content-Type': 'application/json' },
}); body: JSON.stringify({ puzzle: input, coordinate, value })
const parsed = await data.json(); });
assert.property(parsed, 'error'); const parsed = await data.json();
assert.equal(parsed.error, output); assert.property(parsed, 'error');
assert.equal(parsed.error, output);
}
}; };
``` ```
@ -308,15 +332,17 @@ async (getUserInput) => {
'..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..'; '..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..';
const output = 'Invalid value'; const output = 'Invalid value';
const coordinate = 'A1'; const coordinate = 'A1';
const value = 'X'; const values = ['0', '10', 'A'];
const data = await fetch(getUserInput('url') + '/api/check', { for (const value of values) {
method: 'POST', const data = await fetch(getUserInput('url') + '/api/check', {
headers: { 'Content-Type': 'application/json' }, method: 'POST',
body: JSON.stringify({ puzzle: input, coordinate, value }) headers: { 'Content-Type': 'application/json' },
}); body: JSON.stringify({ puzzle: input, coordinate, value })
const parsed = await data.json(); });
assert.property(parsed, 'error'); const parsed = await data.json();
assert.equal(parsed.error, output); assert.property(parsed, 'error');
assert.equal(parsed.error, output);
}
}; };
``` ```