jest assert if empty array
expect(expected).toEqual([])
expect any function jest
expect(something).toEqual(expect.any(Function))
Jest toContain
# 1. Use '.toContain' when you want to check that an item is in an array.
# 2 '.toContain' can also check whether a string is a substring of another string.
test('the flavor list contains lime', () => {
expect(['lime', 'mangle']).toContain('lime');
});
test('the flavor list contains lime', () => {
expect("lime juice").toContain('lime');
});
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us