“Jest Check Array de String” Respostas de código

Jest Test Array de objetos

const users = [{id: 1, name: 'Hugo'}, {id: 2, name: 'Francesco'}];

test('we should have ids 1 and 2', () => {
  expect(users).toEqual(
    expect.arrayContaining([
      expect.objectContaining({id: 1}),
      expect.objectContaining({id: 2})
    ])
  );
});
CharllierJr

Jest Check Array de String

const fruits = ['apple', 'cat'];

test('should have array of string', () => {
  expect(fruits).toEqual(
    expect.arrayContaining([expect.any(String)])
  );
});
Obedient Oyster

Respostas semelhantes a “Jest Check Array de String”

Perguntas semelhantes a “Jest Check Array de String”

Mais respostas relacionadas para “Jest Check Array de String” em JavaScript

Procure respostas de código populares por idioma

Procurar outros idiomas de código