--- id: 587d824b367417b2b2512c4a title: Usare il doppio uguale per affermare l'uguaglianza challengeType: 2 forumTopicId: 301609 dashedName: use-the-double-equals-to-assert-equality --- # --description-- Come promemoria, questo progetto verrĂ  costruito a partire dalla seguente bozza su [Replit](https://replit.com/github/freeCodeCamp/boilerplate-mochachai), o clonato da [GitHub](https://github.com/freeCodeCamp/boilerplate-mochachai/). `equal()` confronta oggetti usando `==`. # --instructions-- All'interno di `tests/1_unit-tests.js`, sotto il test etichettato con `#5`, nella suite `Equality`, cambia ogni asserzione `assert` in `assert.equal` o `assert.notEqual` per far passare il test (dovrebbe risultare `true`). Non alterare gli argomenti passati alle asserzioni. # --hints-- Tutti i test dovrebbero essere superati. ```js (getUserInput) => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=4').then( (data) => { assert.equal(data.state, 'passed'); }, (xhr) => { throw new Error(xhr.responseText); } ); ``` Dovresti scegliere il metodo corretto per la prima asserzione - `equal` oppure `notEqual`. ```js (getUserInput) => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=4').then( (data) => { assert.equal( data.assertions[0].method, 'equal', 'Numbers are coerced into strings with == ' ); }, (xhr) => { throw new Error(xhr.responseText); } ); ``` Dovresti scegliere il metodo corretto per la seconda asserzione - `equal` oppure `notEqual`. ```js (getUserInput) => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=4').then( (data) => { assert.equal( data.assertions[1].method, 'notEqual', ' == compares object references' ); }, (xhr) => { throw new Error(xhr.responseText); } ); ``` Dovresti scegliere il metodo corretto per la terza asserzione - `equal` oppure `notEqual`. ```js (getUserInput) => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=4').then( (data) => { assert.equal( data.assertions[2].method, 'equal', "6 * '2' is 12 ! It should be equal to '12'" ); }, (xhr) => { throw new Error(xhr.responseText); } ); ``` Dovresti scegliere il metodo corretto per la quarta asserzione - `equal` oppure `notEqual`. ```js (getUserInput) => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=4').then( (data) => { assert.equal(data.assertions[3].method, 'notEqual', "6 + '2' is '62'..."); }, (xhr) => { throw new Error(xhr.responseText); } ); ``` # --solutions-- ```js /** Backend challenges don't need solutions, because they would need to be tested against a full working project. Please check our contributing guidelines to learn more. */ ```