How to use the expect.arrayContaining function in expect

To help you get started, we’ve selected a few expect examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github lucasmafra / type-dynamo / features / support / step-definitions / assertion.ts View on Github external
async (tableName, dataTable) => {
    const expected = dataTable.hashes()
    const {Items} = await typeDynamo.dynamoClient.scan({
      TableName: tableName,
    }).promise()
    const itemsInTable = (Items || []).map(
      (item) => DynamoDB.Converter.unmarshall(item))
    // @ts-ignore
    expect(itemsInTable).toEqual(expect.arrayContaining(expected))
  })
github lucasmafra / type-dynamo / features / support / step-definitions / assertion.ts View on Github external
Then('I should get the following items in any order:', function (dataTable) {
  const items = dataTable.hashes()
  // @ts-ignore
  expect(this.result.data).toEqual(expect.arrayContaining(items))
  // @ts-ignore
  expect(items).toEqual(expect.arrayContaining(this.result.data))
})
github lucasmafra / type-dynamo / features / support / step-definitions / assertion.ts View on Github external
Then('I should get the following items in any order:', function (dataTable) {
  const items = dataTable.hashes()
  // @ts-ignore
  expect(this.result.data).toEqual(expect.arrayContaining(items))
  // @ts-ignore
  expect(items).toEqual(expect.arrayContaining(this.result.data))
})

expect

This package exports the `expect` function used in [Jest](https://jestjs.io/). You can find its documentation [on Jest's website](https://jestjs.io/docs/expect).

MIT
Latest version published 1 year ago

Package Health Score

88 / 100
Full package analysis