Files

3.4 KiB
Raw Permalink Blame History

id, title, challengeType, forumTopicId, dashedName
id title challengeType forumTopicId dashedName
587d824e367417b2b2512c57 Перевірка об'єкта на екземпляр конструктора 2 301605 test-if-an-object-is-an-instance-of-a-constructor

--description--

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

#instanceOf стверджує, що об'єкт є екземпляром конструктора.

--instructions--

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

--hints--

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

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

Потрібно обрати правильний метод для першого твердження instanceOf або notInstanceOf.

(getUserInput) =>
  $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=17').then(
    (data) => {
      assert.equal(
        data.assertions[0].method,
        'notInstanceOf',
        'myCar is not an instance of Plane'
      );
    },
    (xhr) => {
      throw new Error(xhr.responseText);
    }
  );

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

(getUserInput) =>
  $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=17').then(
    (data) => {
      assert.equal(
        data.assertions[1].method,
        'instanceOf',
        'airlinePlane is an instance of Plane'
      );
    },
    (xhr) => {
      throw new Error(xhr.responseText);
    }
  );

Потрібно обрати правильний метод для третього твердження instanceOf або notInstanceOf.

(getUserInput) =>
  $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=17').then(
    (data) => {
      assert.equal(
        data.assertions[2].method,
        'instanceOf',
        'everything is an Object in JavaScript...'
      );
    },
    (xhr) => {
      throw new Error(xhr.responseText);
    }
  );

Потрібно обрати правильний метод для четвертого твердження instanceOf або notInstanceOf.

(getUserInput) =>
  $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=17').then(
    (data) => {
      assert.equal(
        data.assertions[3].method,
        'notInstanceOf',
        'myCar.wheels is not an instance of String'
      );
    },
    (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.
*/