Files

2.3 KiB
Raw Permalink Blame History

id, title, challengeType, forumTopicId, dashedName
id title challengeType forumTopicId dashedName
587d824d367417b2b2512c50 Перевірте, чи є значення масивом 2 301600 test-if-a-value-is-an-array

--description--

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

--instructions--

У межах tests/1_unit-tests.js під тестом з міткою #11 в наборі Arrays змініть кожний assert на assert.isArray або assert.isNotArray щоб полегшити проходження тесту (варто оцінювати як true). Не змінюйте аргументи, передані до тверджень.

--hints--

Необхідно пройти усі тести.

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

Потрібно обрати правильний метод для першого твердження - isArray vs. isNotArray.

(getUserInput) =>
  $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=10').then(
    (data) => {
      assert.equal(
        data.assertions[0].method,
        'isArray',
        'String.prototype.split() returns an Array'
      );
    },
    (xhr) => {
      throw new Error(xhr.responseText);
    }
  );

Потрібно обрати правильний метод для другого твердження - isArray vs. isNotArray.

(getUserInput) =>
  $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=10').then(
    (data) => {
      assert.equal(
        data.assertions[1].method,
        'isNotArray',
        'Array.prototype.indexOf() returns a number'
      );
    },
    (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.
*/