Files

3.0 KiB
Raw Permalink Blame History

id, title, challengeType, forumTopicId, dashedName
id title challengeType forumTopicId dashedName
587d824b367417b2b2512c48 Використання Assert.isOK і Assert.isNotOK 2 301607 use-assert-isok-and-assert-isnotok

--description--

Нагадуємо, що цей проєкт будується на основі такого початкового проєкту на Replit або клонується з GitHub.

isOk() перевіряє правдиве значення, а isNotOk() перевіряє хибне значення.

Щоб дізнатися більше про правдиві й хибні значення, перейдіть на завдання Хибний вибивало.

--instructions--

У tests/1_unit-tests.js тесті з позначкою #3 у наборі Basic Assertions змініть кожне assert на assert.isOk() або assert.isNotOk(), щоб пройти тест (має мати значення true). Не змінюйте аргументи, передані до тверджень.

--hints--

Всі тести повинні бути успішно пройдені.

(getUserInput) =>
  $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=2').then(
    (data) => {
      assert.equal(data.state, 'passed');
    },
    (xhr) => {
      throw new Error(xhr.responseText);
    }
  );

Потрібно обрати правильний метод для першого твердження isOk у порівнянні з isNotOk.

(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);
    }
  );

Потрібно обрати правильний метод для другого твердження isOk у порівнянні з isNotOk.

(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);
    }
  );

Потрібно обрати правильний метод для третього твердження isOk у порівнянні з isNotOk.

(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--

/**
  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.
*/