Kuis Matcher & Assertions — Testing

Kuis materi Matcher & Assertions di Testing — uji pemahamanmu dengan pertanyaan pilihan ganda, penjelasan jawaban, dan skor langsung. Main gratis di Hyper Sheets.

Pertanyaan di kuis ini

  1. Apa perbedaan toBe() dan toEqual()?
  2. Cek bahwa array memiliki panjang tertentu:
    expect(items).toHave___(3);
  3. Cek bahwa fungsi melempar error:
    expect(() => parse("!")).to___();
  4. Cek bahwa nilai truthy:
    expect(result).toBe___()
  5. Cek bahwa array mengandung item tertentu:
    expect(fruits).to___('apel');
  6. Apa hasil test ini?
    expect({ a: 1, b: 2 }).toBe({ a: 1, b: 2 });
  7. Negasi matcher — pastikan nilai BUKAN null:
    expect(result).___.toBeNull();