jest tocontain

Solutions on MaxInterview for jest tocontain by the best coders in the world

showing results for - "jest tocontain"
Nohlan
06 Oct 2020
1# 1. Use '.toContain' when you want to check that an item is in an array.
2# 2 '.toContain' can also check whether a string is a substring of another string.
3test('the flavor list contains lime', () => {
4  expect(['lime', 'mangle']).toContain('lime');
5});
6
7test('the flavor list contains lime', () => {
8  expect("lime juice").toContain('lime');
9});
10