📜  Jest toContain - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:35.532000             🧑  作者: Mango

代码示例1
# 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');
});