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` 不應存在於代碼中。
```js
(getUserInput) => assert(!getUserInput('index').match(/var/g));
assert.notMatch(code, /var/g);
```
`catName` 應該是字符串 `Oliver`
```js
assert(catName === 'Oliver');
assert.equal(catName, 'Oliver');
```
`catSound` 應該是字符串 `Meow!`
```js
assert(catSound === 'Meow!');
assert.equal(catSound, 'Meow!');
```
# --seed--

View File

@ -129,9 +129,12 @@ async (getUserInput) => {
```js
async (getUserInput) => {
const input =
'9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..';
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...'
];
const output = 'Expected puzzle to be 81 characters long';
for (const input of inputs) {
const data = await fetch(getUserInput('url') + '/api/solve', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
@ -140,6 +143,7 @@ async (getUserInput) => {
const parsed = await data.json();
assert.property(parsed, 'error');
assert.equal(parsed.error, output);
}
};
```
@ -246,11 +250,14 @@ async (getUserInput) => {
```js
async (getUserInput) => {
const input =
'9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..';
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...'
];
const coordinate = 'A1';
const value = '1';
const output = 'Expected puzzle to be 81 characters long';
for (const input of inputs) {
const data = await fetch(getUserInput('url') + '/api/check', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
@ -259,6 +266,7 @@ async (getUserInput) => {
const parsed = await data.json();
assert.property(parsed, 'error');
assert.equal(parsed.error, output);
}
};
```
@ -266,17 +274,31 @@ async (getUserInput) => {
```js
async (getUserInput) => {
const input =
'..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..';
const inputs = [
{
puzzle: '..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..',
value: '1',
},
{
puzzle: '..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..',
coordinate: 'A1',
},
{
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({ puzzle: input })
body: JSON.stringify(input)
});
const parsed = await data.json();
assert.property(parsed, 'error');
assert.equal(parsed.error, output);
}
};
```
@ -287,8 +309,9 @@ async (getUserInput) => {
const input =
'..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 coordinate = 'XZ18';
const coordinates = ['A0', 'A10', 'J1', 'A', '1', 'XZ18'];
const value = '7';
for (const coordinate of coordinates) {
const data = await fetch(getUserInput('url') + '/api/check', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
@ -297,6 +320,7 @@ async (getUserInput) => {
const parsed = await data.json();
assert.property(parsed, 'error');
assert.equal(parsed.error, output);
}
};
```
@ -308,7 +332,8 @@ async (getUserInput) => {
'..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 coordinate = 'A1';
const value = 'X';
const values = ['0', '10', 'A'];
for (const value of values) {
const data = await fetch(getUserInput('url') + '/api/check', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
@ -317,6 +342,7 @@ async (getUserInput) => {
const parsed = await data.json();
assert.property(parsed, 'error');
assert.equal(parsed.error, output);
}
};
```

View File

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

View File

@ -129,9 +129,12 @@ async (getUserInput) => {
```js
async (getUserInput) => {
const input =
'9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..';
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...'
];
const output = 'Expected puzzle to be 81 characters long';
for (const input of inputs) {
const data = await fetch(getUserInput('url') + '/api/solve', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
@ -140,6 +143,7 @@ async (getUserInput) => {
const parsed = await data.json();
assert.property(parsed, 'error');
assert.equal(parsed.error, output);
}
};
```
@ -246,11 +250,14 @@ async (getUserInput) => {
```js
async (getUserInput) => {
const input =
'9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..';
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...'
];
const coordinate = 'A1';
const value = '1';
const output = 'Expected puzzle to be 81 characters long';
for (const input of inputs) {
const data = await fetch(getUserInput('url') + '/api/check', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
@ -259,6 +266,7 @@ async (getUserInput) => {
const parsed = await data.json();
assert.property(parsed, 'error');
assert.equal(parsed.error, output);
}
};
```
@ -266,17 +274,31 @@ async (getUserInput) => {
```js
async (getUserInput) => {
const input =
'..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..';
const inputs = [
{
puzzle: '..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..',
value: '1',
},
{
puzzle: '..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..',
coordinate: 'A1',
},
{
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({ puzzle: input })
body: JSON.stringify(input)
});
const parsed = await data.json();
assert.property(parsed, 'error');
assert.equal(parsed.error, output);
}
};
```
@ -287,8 +309,9 @@ async (getUserInput) => {
const input =
'..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 coordinate = 'XZ18';
const coordinates = ['A0', 'A10', 'J1', 'A', '1', 'XZ18'];
const value = '7';
for (const coordinate of coordinates) {
const data = await fetch(getUserInput('url') + '/api/check', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
@ -297,6 +320,7 @@ async (getUserInput) => {
const parsed = await data.json();
assert.property(parsed, 'error');
assert.equal(parsed.error, output);
}
};
```
@ -308,7 +332,8 @@ async (getUserInput) => {
'..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 coordinate = 'A1';
const value = 'X';
const values = ['0', '10', 'A'];
for (const value of values) {
const data = await fetch(getUserInput('url') + '/api/check', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
@ -317,6 +342,7 @@ async (getUserInput) => {
const parsed = await data.json();
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.
```js
(getUserInput) => assert(!getUserInput('index').match(/var/g));
assert.notMatch(code, /var/g);
```
Debes cambiar `fCC` a todas mayúsculas.
```js
(getUserInput) => {
assert(getUserInput('index').match(/(FCC)/));
assert(!getUserInput('index').match(/fCC/));
}
assert.match(code, /(FCC)/);
assert.notMatch(code, /(fCC)/);
```
`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`.
```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`.
```js
(getUserInput) =>
assert(getUserInput('index').match(/console\.log\(\s*FCC\s*\,\s*fact\s*\)\s*;?/g));
assert.match(code, /console\.log\(\s*FCC\s*\,\s*fact\s*\)\s*;?/g);
```
# --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.
```js
(getUserInput) => assert(!getUserInput('index').match(/var/g));
assert.notMatch(code, /var/g);
```
`catName` debe ser la cadena `Oliver`.
```js
assert(catName === 'Oliver');
assert.equal(catName, 'Oliver');
```
`catSound` debe ser la cadena `Meow!`
```js
assert(catSound === 'Meow!');
assert.equal(catSound, 'Meow!');
```
# --seed--

View File

@ -129,9 +129,12 @@ Si el rompecabezas enviado a `/api/solve` es mayor o menor que 81 caracteres, el
```js
async (getUserInput) => {
const input =
'9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..';
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...'
];
const output = 'Expected puzzle to be 81 characters long';
for (const input of inputs) {
const data = await fetch(getUserInput('url') + '/api/solve', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
@ -140,6 +143,7 @@ async (getUserInput) => {
const parsed = await data.json();
assert.property(parsed, 'error');
assert.equal(parsed.error, output);
}
};
```
@ -246,11 +250,14 @@ Si el rompecabezas enviado a `/api/check` es mayor o menor que 81 caracteres, el
```js
async (getUserInput) => {
const input =
'9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..';
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...'
];
const coordinate = 'A1';
const value = '1';
const output = 'Expected puzzle to be 81 characters long';
for (const input of inputs) {
const data = await fetch(getUserInput('url') + '/api/check', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
@ -259,6 +266,7 @@ async (getUserInput) => {
const parsed = await data.json();
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
async (getUserInput) => {
const input =
'..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..';
const inputs = [
{
puzzle: '..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..',
value: '1',
},
{
puzzle: '..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..',
coordinate: 'A1',
},
{
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({ puzzle: input })
body: JSON.stringify(input)
});
const parsed = await data.json();
assert.property(parsed, 'error');
assert.equal(parsed.error, output);
}
};
```
@ -287,8 +309,9 @@ async (getUserInput) => {
const input =
'..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 coordinate = 'XZ18';
const coordinates = ['A0', 'A10', 'J1', 'A', '1', 'XZ18'];
const value = '7';
for (const coordinate of coordinates) {
const data = await fetch(getUserInput('url') + '/api/check', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
@ -297,6 +320,7 @@ async (getUserInput) => {
const parsed = await data.json();
assert.property(parsed, 'error');
assert.equal(parsed.error, output);
}
};
```
@ -308,7 +332,8 @@ async (getUserInput) => {
'..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 coordinate = 'A1';
const value = 'X';
const values = ['0', '10', 'A'];
for (const value of values) {
const data = await fetch(getUserInput('url') + '/api/check', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
@ -317,6 +342,7 @@ async (getUserInput) => {
const parsed = await data.json();
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.
```js
(getUserInput) => assert(!getUserInput('index').match(/var/g));
assert.notMatch(code, /var/g);
```
Dovresti cambiare `fCC` a solo maiuscole.
```js
(getUserInput) => {
assert(getUserInput('index').match(/(FCC)/));
assert(!getUserInput('index').match(/fCC/));
}
assert.match(code, /(FCC)/);
assert.notMatch(code, /(fCC)/);
```
`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`.
```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`.
```js
(getUserInput) =>
assert(getUserInput('index').match(/console\.log\(\s*FCC\s*\,\s*fact\s*\)\s*;?/g));
assert.match(code, /console\.log\(\s*FCC\s*\,\s*fact\s*\)\s*;?/g);
```
# --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.
```js
(getUserInput) => assert(!getUserInput('index').match(/var/g));
assert.notMatch(code, /var/g);
```
`catName` dovrebbe essere uguale alla stringa `Oliver`.
```js
assert(catName === 'Oliver');
assert.equal(catName, 'Oliver');
```
`catSound` dovrebbe essere uguale alla stringa `Meow!`
```js
assert(catSound === 'Meow!');
assert.equal(catSound, 'Meow!');
```
# --seed--

View File

@ -129,9 +129,12 @@ Se il rompicapo sottoposto a `/api/solve` ha lunghezza maggiore o minore di 81 c
```js
async (getUserInput) => {
const input =
'9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..';
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...'
];
const output = 'Expected puzzle to be 81 characters long';
for (const input of inputs) {
const data = await fetch(getUserInput('url') + '/api/solve', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
@ -140,6 +143,7 @@ async (getUserInput) => {
const parsed = await data.json();
assert.property(parsed, 'error');
assert.equal(parsed.error, output);
}
};
```
@ -246,11 +250,14 @@ Se il rompicapo sottoposto a `/api/check` ha lunghezza maggiore o minore di 81 c
```js
async (getUserInput) => {
const input =
'9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..';
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...'
];
const coordinate = 'A1';
const value = '1';
const output = 'Expected puzzle to be 81 characters long';
for (const input of inputs) {
const data = await fetch(getUserInput('url') + '/api/check', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
@ -259,6 +266,7 @@ async (getUserInput) => {
const parsed = await data.json();
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
async (getUserInput) => {
const input =
'..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..';
const inputs = [
{
puzzle: '..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..',
value: '1',
},
{
puzzle: '..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..',
coordinate: 'A1',
},
{
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({ puzzle: input })
body: JSON.stringify(input)
});
const parsed = await data.json();
assert.property(parsed, 'error');
assert.equal(parsed.error, output);
}
};
```
@ -287,8 +309,9 @@ async (getUserInput) => {
const input =
'..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 coordinate = 'XZ18';
const coordinates = ['A0', 'A10', 'J1', 'A', '1', 'XZ18'];
const value = '7';
for (const coordinate of coordinates) {
const data = await fetch(getUserInput('url') + '/api/check', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
@ -297,6 +320,7 @@ async (getUserInput) => {
const parsed = await data.json();
assert.property(parsed, 'error');
assert.equal(parsed.error, output);
}
};
```
@ -308,7 +332,8 @@ async (getUserInput) => {
'..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 coordinate = 'A1';
const value = 'X';
const values = ['0', '10', 'A'];
for (const value of values) {
const data = await fetch(getUserInput('url') + '/api/check', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
@ -317,6 +342,7 @@ async (getUserInput) => {
const parsed = await data.json();
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`)、必ず一方の型が他方の型に変換されます。 これを「型強制」と呼びます。 これが行われることで、次のような値の比較が可能になります。
```js
1 == 1
1 == 2
1 == '1'
"3" == 3
1 == 1 // true
1 == 2 // false
1 == '1' // true
"3" == 3 // true
```
これらの式は上から順に、`true``false``true``true` と評価されます。
# --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--
`testEqual(10)` は文字列 `Not Equal` を返す必要があります。
`testEqual(10)` should return the string `Not Equal`
```js
assert(testEqual(10) === 'Not Equal');
```
`testEqual(12)` は文字列 `Equal` を返す必要があります。
`testEqual(12)` should return the string `Equal`
```js
assert(testEqual(12) === 'Equal');
```
`testEqual("12")` は文字列 `Equal` を返す必要があります。
`testEqual("12")` should return the string `Equal`
```js
assert(testEqual('12') === 'Equal');
```
`==` 演算子を使用してください。
You should use the `==` operator
```js
assert(code.match(/==/g) && !code.match(/===/g));

View File

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

View File

@ -14,52 +14,50 @@ dashedName: comparison-with-the-inequality-operator
**例**
```js
1 != 2
1 != "1"
1 != '1'
1 != true
0 != false
1 != 2 // true
1 != "1" // false
1 != '1' // false
1 != true // false
0 != false // false
```
これらの式は上から順に、`true``false``false``false``false` と評価されます。
# --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--
`testNotEqual(99)` は文字列 `Equal` を返す必要があります。
`testNotEqual(99)` should return the string `Equal`
```js
assert(testNotEqual(99) === 'Equal');
```
`testNotEqual("99")` は文字列 `Equal` を返す必要があります。
`testNotEqual("99")` should return the string `Equal`
```js
assert(testNotEqual('99') === 'Equal');
```
`testNotEqual(12)` は文字列 `Not Equal` を返す必要があります。
`testNotEqual(12)` should return the string `Not Equal`
```js
assert(testNotEqual(12) === 'Not Equal');
```
`testNotEqual("12")` は文字列 `Not Equal` を返す必要があります。
`testNotEqual("12")` should return the string `Not Equal`
```js
assert(testNotEqual('12') === 'Not Equal');
```
`testNotEqual("bob")` は文字列 `Not Equal` を返す必要があります。
`testNotEqual("bob")` should return the string `Not Equal`
```js
assert(testNotEqual('bob') === 'Not Equal');
```
`!=` 演算子を使用してください。
You should use the `!=` operator
```js
assert(code.match(/(?!!==)!=/));

View File

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

View File

@ -16,39 +16,37 @@ dashedName: comparison-with-the-strict-equality-operator
**例**
```js
3 === 3
3 === '3'
3 === 3 // true
3 === '3' // false
```
これらの条件ではそれぞれ、`true``false` を返すことになります。
2 番目の例では、 `3``Number` 型で、 `'3'``String` 型です。
In the second example, `3` is a `Number` type and `'3'` is a `String` type.
# --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--
`testStrict(10)` は文字列 `Not Equal` を返す必要があります。
`testStrict(10)` should return the string `Not Equal`
```js
assert(testStrict(10) === 'Not Equal');
```
`testStrict(7)` は文字列 `Equal` を返す必要があります。
`testStrict(7)` should return the string `Equal`
```js
assert(testStrict(7) === 'Equal');
```
`testStrict("7")` は文字列 `Not Equal` を返す必要があります。
`testStrict("7")` should return the string `Not Equal`
```js
assert(testStrict('7') === 'Not Equal');
```
`===` 演算子を使用してください。
You should use the `===` operator
```js
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
3 !== 3
3 !== '3'
4 !== 3
3 !== 3 // false
3 !== '3' // true
4 !== 3 // true
```
これらの式は順に `false``true``true` と評価されます。
# --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--
`testStrictNotEqual(17)` は文字列 `Equal` を返す必要があります。
`testStrictNotEqual(17)` should return the string `Equal`
```js
assert(testStrictNotEqual(17) === 'Equal');
```
`testStrictNotEqual("17")` は文字列 `Not Equal` を返す必要があります。
`testStrictNotEqual("17")` should return the string `Not Equal`
```js
assert(testStrictNotEqual('17') === 'Not Equal');
```
`testStrictNotEqual(12)` は文字列 `Not Equal` を返す必要があります。
`testStrictNotEqual(12)` should return the string `Not Equal`
```js
assert(testStrictNotEqual(12) === 'Not Equal');
```
`testStrictNotEqual("bob")` は文字列 `Not Equal` を返す必要があります。
`testStrictNotEqual("bob")` should return the string `Not Equal`
```js
assert(testStrictNotEqual('bob') === 'Not Equal');
```
`!==` 演算子を使用してください。
You should use the `!==` operator
```js
assert(code.match(/(val\s*!==\s*\d+)|(\d+\s*!==\s*val)/g).length > 0);

View File

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

View File

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

View File

@ -129,9 +129,12 @@ async (getUserInput) => {
```js
async (getUserInput) => {
const input =
'9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..';
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...'
];
const output = 'Expected puzzle to be 81 characters long';
for (const input of inputs) {
const data = await fetch(getUserInput('url') + '/api/solve', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
@ -140,6 +143,7 @@ async (getUserInput) => {
const parsed = await data.json();
assert.property(parsed, 'error');
assert.equal(parsed.error, output);
}
};
```
@ -246,11 +250,14 @@ async (getUserInput) => {
```js
async (getUserInput) => {
const input =
'9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..';
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...'
];
const coordinate = 'A1';
const value = '1';
const output = 'Expected puzzle to be 81 characters long';
for (const input of inputs) {
const data = await fetch(getUserInput('url') + '/api/check', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
@ -259,6 +266,7 @@ async (getUserInput) => {
const parsed = await data.json();
assert.property(parsed, 'error');
assert.equal(parsed.error, output);
}
};
```
@ -266,17 +274,31 @@ async (getUserInput) => {
```js
async (getUserInput) => {
const input =
'..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..';
const inputs = [
{
puzzle: '..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..',
value: '1',
},
{
puzzle: '..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..',
coordinate: 'A1',
},
{
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({ puzzle: input })
body: JSON.stringify(input)
});
const parsed = await data.json();
assert.property(parsed, 'error');
assert.equal(parsed.error, output);
}
};
```
@ -287,8 +309,9 @@ async (getUserInput) => {
const input =
'..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 coordinate = 'XZ18';
const coordinates = ['A0', 'A10', 'J1', 'A', '1', 'XZ18'];
const value = '7';
for (const coordinate of coordinates) {
const data = await fetch(getUserInput('url') + '/api/check', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
@ -297,6 +320,7 @@ async (getUserInput) => {
const parsed = await data.json();
assert.property(parsed, 'error');
assert.equal(parsed.error, output);
}
};
```
@ -308,7 +332,8 @@ async (getUserInput) => {
'..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 coordinate = 'A1';
const value = 'X';
const values = ['0', '10', 'A'];
for (const value of values) {
const data = await fetch(getUserInput('url') + '/api/check', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
@ -317,6 +342,7 @@ async (getUserInput) => {
const parsed = await data.json();
assert.property(parsed, 'error');
assert.equal(parsed.error, output);
}
};
```

View File

@ -9,7 +9,7 @@ dashedName: build-a-boilerplate
# --description--
この 170 のレッスンコースでは、コマンドラインのみを使用してウェブサイトのボイラープレートを作成することで、基本のコマンドについて学習します。
この 170 のレッスンから成るコースでは、コマンドラインのみを使用してウェブサイトのボイラープレートを作成することで、基本のコマンドについて学習します。
# --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.
```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.
```js
(getUserInput) => {
assert(getUserInput('index').match(/(FCC)/));
assert(!getUserInput('index').match(/fCC/));
}
assert.match(code, /(FCC)/);
assert.notMatch(code, /(fCC)/);
```
`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`.
```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`.
```js
(getUserInput) =>
assert(getUserInput('index').match(/console\.log\(\s*FCC\s*\,\s*fact\s*\)\s*;?/g));
assert.match(code, /console\.log\(\s*FCC\s*\,\s*fact\s*\)\s*;?/g);
```
# --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.
```js
(getUserInput) => assert(!getUserInput('index').match(/var/g));
assert.notMatch(code, /var/g);
```
A variável `catName` deve ser uma string de valor `Oliver`.
```js
assert(catName === 'Oliver');
assert.equal(catName, 'Oliver');
```
`catSound` deve ser uma string de valor `Meow!`
```js
assert(catSound === 'Meow!');
assert.equal(catSound, 'Meow!');
```
# --seed--

View File

@ -129,9 +129,12 @@ Se o desafio enviado a `/api/solve` é maior ou menor que 81 caracteres, o valor
```js
async (getUserInput) => {
const input =
'9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..';
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...'
];
const output = 'Expected puzzle to be 81 characters long';
for (const input of inputs) {
const data = await fetch(getUserInput('url') + '/api/solve', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
@ -140,6 +143,7 @@ async (getUserInput) => {
const parsed = await data.json();
assert.property(parsed, 'error');
assert.equal(parsed.error, output);
}
};
```
@ -246,11 +250,14 @@ Se o desafio enviado a `/api/check` é maior ou menor que 81 caracteres, o valor
```js
async (getUserInput) => {
const input =
'9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..';
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...'
];
const coordinate = 'A1';
const value = '1';
const output = 'Expected puzzle to be 81 characters long';
for (const input of inputs) {
const data = await fetch(getUserInput('url') + '/api/check', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
@ -259,6 +266,7 @@ async (getUserInput) => {
const parsed = await data.json();
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
async (getUserInput) => {
const input =
'..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..';
const inputs = [
{
puzzle: '..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..',
value: '1',
},
{
puzzle: '..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..',
coordinate: 'A1',
},
{
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({ puzzle: input })
body: JSON.stringify(input)
});
const parsed = await data.json();
assert.property(parsed, 'error');
assert.equal(parsed.error, output);
}
};
```
@ -287,8 +309,9 @@ async (getUserInput) => {
const input =
'..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 coordinate = 'XZ18';
const coordinates = ['A0', 'A10', 'J1', 'A', '1', 'XZ18'];
const value = '7';
for (const coordinate of coordinates) {
const data = await fetch(getUserInput('url') + '/api/check', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
@ -297,6 +320,7 @@ async (getUserInput) => {
const parsed = await data.json();
assert.property(parsed, 'error');
assert.equal(parsed.error, output);
}
};
```
@ -308,7 +332,8 @@ async (getUserInput) => {
'..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 coordinate = 'A1';
const value = 'X';
const values = ['0', '10', 'A'];
for (const value of values) {
const data = await fetch(getUserInput('url') + '/api/check', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
@ -317,6 +342,7 @@ async (getUserInput) => {
const parsed = await data.json();
assert.property(parsed, 'error');
assert.equal(parsed.error, output);
}
};
```

View File

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

View File

@ -129,9 +129,12 @@ async (getUserInput) => {
```js
async (getUserInput) => {
const input =
'9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..';
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...'
];
const output = 'Expected puzzle to be 81 characters long';
for (const input of inputs) {
const data = await fetch(getUserInput('url') + '/api/solve', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
@ -140,6 +143,7 @@ async (getUserInput) => {
const parsed = await data.json();
assert.property(parsed, 'error');
assert.equal(parsed.error, output);
}
};
```
@ -246,11 +250,14 @@ async (getUserInput) => {
```js
async (getUserInput) => {
const input =
'9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..';
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...'
];
const coordinate = 'A1';
const value = '1';
const output = 'Expected puzzle to be 81 characters long';
for (const input of inputs) {
const data = await fetch(getUserInput('url') + '/api/check', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
@ -259,6 +266,7 @@ async (getUserInput) => {
const parsed = await data.json();
assert.property(parsed, 'error');
assert.equal(parsed.error, output);
}
};
```
@ -266,17 +274,31 @@ async (getUserInput) => {
```js
async (getUserInput) => {
const input =
'..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..';
const inputs = [
{
puzzle: '..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..',
value: '1',
},
{
puzzle: '..9..5.1.85.4....2432......1...69.83.9.....6.62.71...9......1945....4.37.4.3..6..',
coordinate: 'A1',
},
{
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({ puzzle: input })
body: JSON.stringify(input)
});
const parsed = await data.json();
assert.property(parsed, 'error');
assert.equal(parsed.error, output);
}
};
```
@ -287,8 +309,9 @@ async (getUserInput) => {
const input =
'..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 coordinate = 'XZ18';
const coordinates = ['A0', 'A10', 'J1', 'A', '1', 'XZ18'];
const value = '7';
for (const coordinate of coordinates) {
const data = await fetch(getUserInput('url') + '/api/check', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
@ -297,6 +320,7 @@ async (getUserInput) => {
const parsed = await data.json();
assert.property(parsed, 'error');
assert.equal(parsed.error, output);
}
};
```
@ -308,7 +332,8 @@ async (getUserInput) => {
'..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 coordinate = 'A1';
const value = 'X';
const values = ['0', '10', 'A'];
for (const value of values) {
const data = await fetch(getUserInput('url') + '/api/check', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
@ -317,6 +342,7 @@ async (getUserInput) => {
const parsed = await data.json();
assert.property(parsed, 'error');
assert.equal(parsed.error, output);
}
};
```