1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | 6x | expect.extend({ toBeOneOf(received, argument) { const pass = (Array.isArray(argument) && argument.indexOf(received) >= 0); if (pass) { return { message: () => `expected ${received} not to be one of ${argument.join(', ')}`, pass: true, }; } return { message: () => `expected ${received} to be one of ${argument.join(', ')}`, pass: false, }; }, }); |