Latihan 1: Matcher & Assertions — Testing

Latihan 1 dari materi Matcher & Assertions di Testing — praktek dengan editor kode interaktif, test case otomatis, dan hint terpandu. Langsung jalan di browser.

Buat fungsi expect(value) yang mengembalikan object dengan matcher berikut:

Setiap matcher juga harus bekerja dengan .not (negasi).

expect(5).toBe(5); // true
expect({a:1}).toEqual({a:1}); // true
expect([1,2,3]).toContain(2); // true
expect(5).not.toBe(3); // true

Hint