test('adds 1 + 2 to equal 3', () => { expect(sum(1, 2)).toBe(3); }); test('object assignment', () => { const data = {one: 1}; data['two'] = 2; expect(data).toEqual({one: 1, two: 2}); }); `toBeNull matches only null toBeUndefined matches only undefined toBeDefined is the opposite of toBeUndefined toBeTruthy matches anything that an if statement treats as true toBeFalsy matches anything that an if statement treats as false`
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter