diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/explore-differences-between-the-var-and-let-keywords.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/explore-differences-between-the-var-and-let-keywords.md index abfca0284f..4b2c8bd323 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/explore-differences-between-the-var-and-let-keywords.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/explore-differences-between-the-var-and-let-keywords.md @@ -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-- diff --git a/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-projects/sudoku-solver.md b/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-projects/sudoku-solver.md index 75f0e1d87f..b5fa204978 100644 --- a/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-projects/sudoku-solver.md +++ b/curriculum/challenges/chinese-traditional/06-quality-assurance/quality-assurance-projects/sudoku-solver.md @@ -129,17 +129,21 @@ 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'; - const data = await fetch(getUserInput('url') + '/api/solve', { - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ puzzle: input }) - }); - const parsed = await data.json(); - assert.property(parsed, 'error'); - assert.equal(parsed.error, output); + for (const input of inputs) { + const data = await fetch(getUserInput('url') + '/api/solve', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ puzzle: input }) + }); + const parsed = await data.json(); + assert.property(parsed, 'error'); + assert.equal(parsed.error, output); + } }; ``` @@ -246,19 +250,23 @@ 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'; - const data = await fetch(getUserInput('url') + '/api/check', { - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ puzzle: input, coordinate, value }) - }); - const parsed = await data.json(); - assert.property(parsed, 'error'); - assert.equal(parsed.error, output); + for (const input of inputs) { + const data = await fetch(getUserInput('url') + '/api/check', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ puzzle: input, coordinate, value }) + }); + 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 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 }) - }); - const parsed = await data.json(); - assert.property(parsed, 'error'); - assert.equal(parsed.error, output); + 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(input) + }); + const parsed = await data.json(); + assert.property(parsed, 'error'); + assert.equal(parsed.error, output); + } }; ``` @@ -287,16 +309,18 @@ 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'; - const data = await fetch(getUserInput('url') + '/api/check', { - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ puzzle: input, coordinate, value }) - }); - const parsed = await data.json(); - assert.property(parsed, 'error'); - assert.equal(parsed.error, output); + for (const coordinate of coordinates) { + const data = await fetch(getUserInput('url') + '/api/check', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ puzzle: input, coordinate, value }) + }); + const parsed = await data.json(); + 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..'; const output = 'Invalid value'; const coordinate = 'A1'; - const value = 'X'; - const data = await fetch(getUserInput('url') + '/api/check', { - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ puzzle: input, coordinate, value }) - }); - const parsed = await data.json(); - assert.property(parsed, 'error'); - assert.equal(parsed.error, output); + 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' }, + body: JSON.stringify({ puzzle: input, coordinate, value }) + }); + const parsed = await data.json(); + assert.property(parsed, 'error'); + assert.equal(parsed.error, output); + } }; ``` diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/explore-differences-between-the-var-and-let-keywords.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/explore-differences-between-the-var-and-let-keywords.md index f767866eb9..38f274f8c2 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/explore-differences-between-the-var-and-let-keywords.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/explore-differences-between-the-var-and-let-keywords.md @@ -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-- diff --git a/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-projects/sudoku-solver.md b/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-projects/sudoku-solver.md index 26038ad359..b0cb46112b 100644 --- a/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-projects/sudoku-solver.md +++ b/curriculum/challenges/chinese/06-quality-assurance/quality-assurance-projects/sudoku-solver.md @@ -129,17 +129,21 @@ 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'; - const data = await fetch(getUserInput('url') + '/api/solve', { - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ puzzle: input }) - }); - const parsed = await data.json(); - assert.property(parsed, 'error'); - assert.equal(parsed.error, output); + for (const input of inputs) { + const data = await fetch(getUserInput('url') + '/api/solve', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ puzzle: input }) + }); + const parsed = await data.json(); + assert.property(parsed, 'error'); + assert.equal(parsed.error, output); + } }; ``` @@ -246,19 +250,23 @@ 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'; - const data = await fetch(getUserInput('url') + '/api/check', { - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ puzzle: input, coordinate, value }) - }); - const parsed = await data.json(); - assert.property(parsed, 'error'); - assert.equal(parsed.error, output); + for (const input of inputs) { + const data = await fetch(getUserInput('url') + '/api/check', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ puzzle: input, coordinate, value }) + }); + 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 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 }) - }); - const parsed = await data.json(); - assert.property(parsed, 'error'); - assert.equal(parsed.error, output); + 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(input) + }); + const parsed = await data.json(); + assert.property(parsed, 'error'); + assert.equal(parsed.error, output); + } }; ``` @@ -287,16 +309,18 @@ 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'; - const data = await fetch(getUserInput('url') + '/api/check', { - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ puzzle: input, coordinate, value }) - }); - const parsed = await data.json(); - assert.property(parsed, 'error'); - assert.equal(parsed.error, output); + for (const coordinate of coordinates) { + const data = await fetch(getUserInput('url') + '/api/check', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ puzzle: input, coordinate, value }) + }); + const parsed = await data.json(); + 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..'; const output = 'Invalid value'; const coordinate = 'A1'; - const value = 'X'; - const data = await fetch(getUserInput('url') + '/api/check', { - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ puzzle: input, coordinate, value }) - }); - const parsed = await data.json(); - assert.property(parsed, 'error'); - assert.equal(parsed.error, output); + 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' }, + body: JSON.stringify({ puzzle: input, coordinate, value }) + }); + const parsed = await data.json(); + assert.property(parsed, 'error'); + assert.equal(parsed.error, output); + } }; ``` diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/declare-a-read-only-variable-with-the-const-keyword.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/declare-a-read-only-variable-with-the-const-keyword.md index 0fc1a390e0..84f82acb27 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/declare-a-read-only-variable-with-the-const-keyword.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/declare-a-read-only-variable-with-the-const-keyword.md @@ -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-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/explore-differences-between-the-var-and-let-keywords.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/explore-differences-between-the-var-and-let-keywords.md index 84f34213d9..f79398bf86 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/explore-differences-between-the-var-and-let-keywords.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/explore-differences-between-the-var-and-let-keywords.md @@ -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-- diff --git a/curriculum/challenges/espanol/06-quality-assurance/quality-assurance-projects/sudoku-solver.md b/curriculum/challenges/espanol/06-quality-assurance/quality-assurance-projects/sudoku-solver.md index 53694b4e85..6b70eeda11 100644 --- a/curriculum/challenges/espanol/06-quality-assurance/quality-assurance-projects/sudoku-solver.md +++ b/curriculum/challenges/espanol/06-quality-assurance/quality-assurance-projects/sudoku-solver.md @@ -129,17 +129,21 @@ 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'; - const data = await fetch(getUserInput('url') + '/api/solve', { - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ puzzle: input }) - }); - const parsed = await data.json(); - assert.property(parsed, 'error'); - assert.equal(parsed.error, output); + for (const input of inputs) { + const data = await fetch(getUserInput('url') + '/api/solve', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ puzzle: input }) + }); + const parsed = await data.json(); + 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 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'; - const data = await fetch(getUserInput('url') + '/api/check', { - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ puzzle: input, coordinate, value }) - }); - const parsed = await data.json(); - assert.property(parsed, 'error'); - assert.equal(parsed.error, output); + for (const input of inputs) { + const data = await fetch(getUserInput('url') + '/api/check', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ puzzle: input, coordinate, value }) + }); + 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 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 }) - }); - const parsed = await data.json(); - assert.property(parsed, 'error'); - assert.equal(parsed.error, output); + 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(input) + }); + const parsed = await data.json(); + assert.property(parsed, 'error'); + assert.equal(parsed.error, output); + } }; ``` @@ -287,16 +309,18 @@ 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'; - const data = await fetch(getUserInput('url') + '/api/check', { - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ puzzle: input, coordinate, value }) - }); - const parsed = await data.json(); - assert.property(parsed, 'error'); - assert.equal(parsed.error, output); + for (const coordinate of coordinates) { + const data = await fetch(getUserInput('url') + '/api/check', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ puzzle: input, coordinate, value }) + }); + const parsed = await data.json(); + 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..'; const output = 'Invalid value'; const coordinate = 'A1'; - const value = 'X'; - const data = await fetch(getUserInput('url') + '/api/check', { - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ puzzle: input, coordinate, value }) - }); - const parsed = await data.json(); - assert.property(parsed, 'error'); - assert.equal(parsed.error, output); + 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' }, + body: JSON.stringify({ puzzle: input, coordinate, value }) + }); + const parsed = await data.json(); + assert.property(parsed, 'error'); + assert.equal(parsed.error, output); + } }; ``` diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/declare-a-read-only-variable-with-the-const-keyword.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/declare-a-read-only-variable-with-the-const-keyword.md index 6df5cdcfc4..ae5100f33c 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/declare-a-read-only-variable-with-the-const-keyword.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/declare-a-read-only-variable-with-the-const-keyword.md @@ -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-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/explore-differences-between-the-var-and-let-keywords.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/explore-differences-between-the-var-and-let-keywords.md index bc3fff3b86..783a78f8a9 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/explore-differences-between-the-var-and-let-keywords.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/explore-differences-between-the-var-and-let-keywords.md @@ -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-- diff --git a/curriculum/challenges/italian/06-quality-assurance/quality-assurance-projects/sudoku-solver.md b/curriculum/challenges/italian/06-quality-assurance/quality-assurance-projects/sudoku-solver.md index a73b9d4319..a72ecb973f 100644 --- a/curriculum/challenges/italian/06-quality-assurance/quality-assurance-projects/sudoku-solver.md +++ b/curriculum/challenges/italian/06-quality-assurance/quality-assurance-projects/sudoku-solver.md @@ -129,17 +129,21 @@ 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'; - const data = await fetch(getUserInput('url') + '/api/solve', { - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ puzzle: input }) - }); - const parsed = await data.json(); - assert.property(parsed, 'error'); - assert.equal(parsed.error, output); + for (const input of inputs) { + const data = await fetch(getUserInput('url') + '/api/solve', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ puzzle: input }) + }); + const parsed = await data.json(); + 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 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'; - const data = await fetch(getUserInput('url') + '/api/check', { - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ puzzle: input, coordinate, value }) - }); - const parsed = await data.json(); - assert.property(parsed, 'error'); - assert.equal(parsed.error, output); + for (const input of inputs) { + const data = await fetch(getUserInput('url') + '/api/check', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ puzzle: input, coordinate, value }) + }); + 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 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 }) - }); - const parsed = await data.json(); - assert.property(parsed, 'error'); - assert.equal(parsed.error, output); + 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(input) + }); + const parsed = await data.json(); + assert.property(parsed, 'error'); + assert.equal(parsed.error, output); + } }; ``` @@ -287,16 +309,18 @@ 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'; - const data = await fetch(getUserInput('url') + '/api/check', { - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ puzzle: input, coordinate, value }) - }); - const parsed = await data.json(); - assert.property(parsed, 'error'); - assert.equal(parsed.error, output); + for (const coordinate of coordinates) { + const data = await fetch(getUserInput('url') + '/api/check', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ puzzle: input, coordinate, value }) + }); + const parsed = await data.json(); + 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..'; const output = 'Invalid value'; const coordinate = 'A1'; - const value = 'X'; - const data = await fetch(getUserInput('url') + '/api/check', { - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ puzzle: input, coordinate, value }) - }); - const parsed = await data.json(); - assert.property(parsed, 'error'); - assert.equal(parsed.error, output); + 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' }, + body: JSON.stringify({ puzzle: input, coordinate, value }) + }); + const parsed = await data.json(); + assert.property(parsed, 'error'); + assert.equal(parsed.error, output); + } }; ``` diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator.md index 275ddf2c43..a89426d04c 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator.md @@ -25,39 +25,37 @@ function equalityTest(myVal) { `myVal` が `10` と等しい場合には、等価演算子は `true` を返し、中括弧内のコードが実行されて、関数は `Equal` を返します。 それ以外の場合、関数は `Not Equal` を返します。 JavaScript では、比較する 2 つのデータのデータ型が異なる場合 (たとえば `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)); diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-operator.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-operator.md index 5774defea8..26ae8d15ef 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-operator.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-operator.md @@ -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); diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-or-equal-to-operator.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-or-equal-to-operator.md index 0ad4f88250..8ddd9c518d 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-or-equal-to-operator.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-or-equal-to-operator.md @@ -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); diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-inequality-operator.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-inequality-operator.md index 4c58546dea..800a969106 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-inequality-operator.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-inequality-operator.md @@ -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(/(?!!==)!=/)); diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-operator.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-operator.md index 581fb811eb..06d7cfc26b 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-operator.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-operator.md @@ -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); diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-or-equal-to-operator.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-or-equal-to-operator.md index bdb54e353f..03a476a9d3 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-or-equal-to-operator.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-or-equal-to-operator.md @@ -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); diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-equality-operator.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-equality-operator.md index a2f695c994..d4ee4ee4b1 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-equality-operator.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-equality-operator.md @@ -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); diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-inequality-operator.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-inequality-operator.md index 07b7d3befa..85d0c92acd 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-inequality-operator.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-inequality-operator.md @@ -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); diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/declare-a-read-only-variable-with-the-const-keyword.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/declare-a-read-only-variable-with-the-const-keyword.md index d5b65b3151..4a051ca4de 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/declare-a-read-only-variable-with-the-const-keyword.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/declare-a-read-only-variable-with-the-const-keyword.md @@ -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-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/explore-differences-between-the-var-and-let-keywords.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/explore-differences-between-the-var-and-let-keywords.md index 16d3f9dfbd..2ec6981d61 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/explore-differences-between-the-var-and-let-keywords.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/explore-differences-between-the-var-and-let-keywords.md @@ -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-- diff --git a/curriculum/challenges/japanese/06-quality-assurance/quality-assurance-projects/sudoku-solver.md b/curriculum/challenges/japanese/06-quality-assurance/quality-assurance-projects/sudoku-solver.md index dd5bea386d..e2825e8990 100644 --- a/curriculum/challenges/japanese/06-quality-assurance/quality-assurance-projects/sudoku-solver.md +++ b/curriculum/challenges/japanese/06-quality-assurance/quality-assurance-projects/sudoku-solver.md @@ -129,17 +129,21 @@ 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'; - const data = await fetch(getUserInput('url') + '/api/solve', { - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ puzzle: input }) - }); - const parsed = await data.json(); - assert.property(parsed, 'error'); - assert.equal(parsed.error, output); + for (const input of inputs) { + const data = await fetch(getUserInput('url') + '/api/solve', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ puzzle: input }) + }); + const parsed = await data.json(); + assert.property(parsed, 'error'); + assert.equal(parsed.error, output); + } }; ``` @@ -246,19 +250,23 @@ 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'; - const data = await fetch(getUserInput('url') + '/api/check', { - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ puzzle: input, coordinate, value }) - }); - const parsed = await data.json(); - assert.property(parsed, 'error'); - assert.equal(parsed.error, output); + for (const input of inputs) { + const data = await fetch(getUserInput('url') + '/api/check', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ puzzle: input, coordinate, value }) + }); + 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 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 }) - }); - const parsed = await data.json(); - assert.property(parsed, 'error'); - assert.equal(parsed.error, output); + 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(input) + }); + const parsed = await data.json(); + assert.property(parsed, 'error'); + assert.equal(parsed.error, output); + } }; ``` @@ -287,16 +309,18 @@ 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'; - const data = await fetch(getUserInput('url') + '/api/check', { - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ puzzle: input, coordinate, value }) - }); - const parsed = await data.json(); - assert.property(parsed, 'error'); - assert.equal(parsed.error, output); + for (const coordinate of coordinates) { + const data = await fetch(getUserInput('url') + '/api/check', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ puzzle: input, coordinate, value }) + }); + const parsed = await data.json(); + 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..'; const output = 'Invalid value'; const coordinate = 'A1'; - const value = 'X'; - const data = await fetch(getUserInput('url') + '/api/check', { - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ puzzle: input, coordinate, value }) - }); - const parsed = await data.json(); - assert.property(parsed, 'error'); - assert.equal(parsed.error, output); + 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' }, + body: JSON.stringify({ puzzle: input, coordinate, value }) + }); + const parsed = await data.json(); + assert.property(parsed, 'error'); + assert.equal(parsed.error, output); + } }; ``` diff --git a/curriculum/challenges/japanese/13-relational-databases/learn-bash-by-building-a-boilerplate/build-a-boilerplate.md b/curriculum/challenges/japanese/13-relational-databases/learn-bash-by-building-a-boilerplate/build-a-boilerplate.md index 99884eaa1c..e2184beb3d 100644 --- a/curriculum/challenges/japanese/13-relational-databases/learn-bash-by-building-a-boilerplate/build-a-boilerplate.md +++ b/curriculum/challenges/japanese/13-relational-databases/learn-bash-by-building-a-boilerplate/build-a-boilerplate.md @@ -9,7 +9,7 @@ dashedName: build-a-boilerplate # --description-- -この 170 のレッスンコースでは、コマンドラインのみを使用してウェブサイトのボイラープレートを作成することで、基本のコマンドについて学習します。 +この 170 のレッスンから成るコースでは、コマンドラインのみを使用してウェブサイトのボイラープレートを作成することで、基本のコマンドについて学習します。 # --instructions-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/declare-a-read-only-variable-with-the-const-keyword.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/declare-a-read-only-variable-with-the-const-keyword.md index 34d730a542..98f3849b7b 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/declare-a-read-only-variable-with-the-const-keyword.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/declare-a-read-only-variable-with-the-const-keyword.md @@ -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-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/explore-differences-between-the-var-and-let-keywords.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/explore-differences-between-the-var-and-let-keywords.md index 32f50dac34..22375227a0 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/explore-differences-between-the-var-and-let-keywords.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/explore-differences-between-the-var-and-let-keywords.md @@ -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-- diff --git a/curriculum/challenges/portuguese/06-quality-assurance/quality-assurance-projects/sudoku-solver.md b/curriculum/challenges/portuguese/06-quality-assurance/quality-assurance-projects/sudoku-solver.md index 2a515fc090..9a2b5e991b 100644 --- a/curriculum/challenges/portuguese/06-quality-assurance/quality-assurance-projects/sudoku-solver.md +++ b/curriculum/challenges/portuguese/06-quality-assurance/quality-assurance-projects/sudoku-solver.md @@ -129,17 +129,21 @@ 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'; - const data = await fetch(getUserInput('url') + '/api/solve', { - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ puzzle: input }) - }); - const parsed = await data.json(); - assert.property(parsed, 'error'); - assert.equal(parsed.error, output); + for (const input of inputs) { + const data = await fetch(getUserInput('url') + '/api/solve', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ puzzle: input }) + }); + const parsed = await data.json(); + 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 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'; - const data = await fetch(getUserInput('url') + '/api/check', { - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ puzzle: input, coordinate, value }) - }); - const parsed = await data.json(); - assert.property(parsed, 'error'); - assert.equal(parsed.error, output); + for (const input of inputs) { + const data = await fetch(getUserInput('url') + '/api/check', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ puzzle: input, coordinate, value }) + }); + 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 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 }) - }); - const parsed = await data.json(); - assert.property(parsed, 'error'); - assert.equal(parsed.error, output); + 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(input) + }); + const parsed = await data.json(); + assert.property(parsed, 'error'); + assert.equal(parsed.error, output); + } }; ``` @@ -287,16 +309,18 @@ 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'; - const data = await fetch(getUserInput('url') + '/api/check', { - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ puzzle: input, coordinate, value }) - }); - const parsed = await data.json(); - assert.property(parsed, 'error'); - assert.equal(parsed.error, output); + for (const coordinate of coordinates) { + const data = await fetch(getUserInput('url') + '/api/check', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ puzzle: input, coordinate, value }) + }); + const parsed = await data.json(); + 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..'; const output = 'Invalid value'; const coordinate = 'A1'; - const value = 'X'; - const data = await fetch(getUserInput('url') + '/api/check', { - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ puzzle: input, coordinate, value }) - }); - const parsed = await data.json(); - assert.property(parsed, 'error'); - assert.equal(parsed.error, output); + 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' }, + body: JSON.stringify({ puzzle: input, coordinate, value }) + }); + const parsed = await data.json(); + assert.property(parsed, 'error'); + assert.equal(parsed.error, output); + } }; ``` diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/explore-differences-between-the-var-and-let-keywords.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/explore-differences-between-the-var-and-let-keywords.md index cbf6173bfd..b2ff46849a 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/explore-differences-between-the-var-and-let-keywords.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/explore-differences-between-the-var-and-let-keywords.md @@ -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-- diff --git a/curriculum/challenges/ukrainian/06-quality-assurance/quality-assurance-projects/sudoku-solver.md b/curriculum/challenges/ukrainian/06-quality-assurance/quality-assurance-projects/sudoku-solver.md index 83108e773a..dafa8e2fdf 100644 --- a/curriculum/challenges/ukrainian/06-quality-assurance/quality-assurance-projects/sudoku-solver.md +++ b/curriculum/challenges/ukrainian/06-quality-assurance/quality-assurance-projects/sudoku-solver.md @@ -129,17 +129,21 @@ 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'; - const data = await fetch(getUserInput('url') + '/api/solve', { - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ puzzle: input }) - }); - const parsed = await data.json(); - assert.property(parsed, 'error'); - assert.equal(parsed.error, output); + for (const input of inputs) { + const data = await fetch(getUserInput('url') + '/api/solve', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ puzzle: input }) + }); + const parsed = await data.json(); + assert.property(parsed, 'error'); + assert.equal(parsed.error, output); + } }; ``` @@ -246,19 +250,23 @@ 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'; - const data = await fetch(getUserInput('url') + '/api/check', { - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ puzzle: input, coordinate, value }) - }); - const parsed = await data.json(); - assert.property(parsed, 'error'); - assert.equal(parsed.error, output); + for (const input of inputs) { + const data = await fetch(getUserInput('url') + '/api/check', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ puzzle: input, coordinate, value }) + }); + 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 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 }) - }); - const parsed = await data.json(); - assert.property(parsed, 'error'); - assert.equal(parsed.error, output); + 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(input) + }); + const parsed = await data.json(); + assert.property(parsed, 'error'); + assert.equal(parsed.error, output); + } }; ``` @@ -287,16 +309,18 @@ 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'; - const data = await fetch(getUserInput('url') + '/api/check', { - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ puzzle: input, coordinate, value }) - }); - const parsed = await data.json(); - assert.property(parsed, 'error'); - assert.equal(parsed.error, output); + for (const coordinate of coordinates) { + const data = await fetch(getUserInput('url') + '/api/check', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ puzzle: input, coordinate, value }) + }); + const parsed = await data.json(); + 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..'; const output = 'Invalid value'; const coordinate = 'A1'; - const value = 'X'; - const data = await fetch(getUserInput('url') + '/api/check', { - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ puzzle: input, coordinate, value }) - }); - const parsed = await data.json(); - assert.property(parsed, 'error'); - assert.equal(parsed.error, output); + 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' }, + body: JSON.stringify({ puzzle: input, coordinate, value }) + }); + const parsed = await data.json(); + assert.property(parsed, 'error'); + assert.equal(parsed.error, output); + } }; ```