--- id: 587d824b367417b2b2512c48 title: Usar Assert.isOK e Assert.isNotOK challengeType: 2 forumTopicId: 301607 dashedName: use-assert-isok-and-assert-isnotok --- # --description-- Lembrando que este projeto está sendo construído a partir do [Replit](https://replit.com/github/freeCodeCamp/boilerplate-mochachai), ou pose ser clonado no [GitHub](https://github.com/freeCodeCamp/boilerplate-mochachai/). `isOk()` testará se um valor é verdadeiro e `isNotOk()` testará se um valor é falso. Para saber mais sobre valores verdadeiros e falsos, experimente nosso [desafio](https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-algorithm-scripting/falsy-bouncer) Remover falsos. # --instructions-- Em `tests/1_unit-tests.js`, no teste classificado como `#3` e na suíte `Basic Assertions`, modifique cada `assert` para `assert.isOk()` ou para `assert.isNotOk()`, de maneira que cada teste passe (seja avaliado como `true`). Não altere os argumentos passados às afirmações. # --hints-- Todos os testes devem passar. ```js (getUserInput) => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=2').then( (data) => { assert.equal(data.state, 'passed'); }, (xhr) => { throw new Error(xhr.responseText); } ); ``` Você deve escolher o método correto para a primeira afirmação - `isOk` ou `isNotOk`. ```js (getUserInput) => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=2').then( (data) => { assert.equal(data.assertions[0].method, 'isNotOk', 'Null is falsy'); }, (xhr) => { throw new Error(xhr.responseText); } ); ``` Você deve escolher o método correto para a segunda afirmação - `isOk` ou `isNotOk`. ```js (getUserInput) => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=2').then( (data) => { assert.equal(data.assertions[1].method, 'isOk', 'A string is truthy'); }, (xhr) => { throw new Error(xhr.responseText); } ); ``` Você deve escolher o método correto para a terceira afirmação - `isOk` ou `isNotOk`. ```js (getUserInput) => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=2').then( (data) => { assert.equal(data.assertions[2].method, 'isOk', 'true is truthy'); }, (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. */ ```