This commit is contained in:
Adria Navarro 2023-09-08 16:31:47 +02:00
parent 1a7a1cdd1b
commit 8858fe3887
1 changed files with 21 additions and 8 deletions

View File

@ -20,6 +20,7 @@ import {
Table, Table,
} from "@budibase/types" } from "@budibase/types"
import { import {
expectAnyExternalColsAttributes,
expectAnyInternalColsAttributes, expectAnyInternalColsAttributes,
generator, generator,
mocks, mocks,
@ -1178,8 +1179,18 @@ describe.each([
expect(response.body.rows).toHaveLength(5) expect(response.body.rows).toHaveLength(5)
expect(response.body).toEqual({ expect(response.body).toEqual({
rows: expect.arrayContaining( rows: expect.arrayContaining(
expectedRows.map(expect.objectContaining) expectedRows.map(r => ({
_viewId: createViewResponse.id,
tableId: table._id,
name: r.name,
age: r.age,
_id: r._id,
_rev: r._rev,
...defaultRowFields,
}))
), ),
hasNextPage: false,
bookmark: null,
}) })
}) })
@ -1277,9 +1288,9 @@ describe.each([
const response = await config.api.viewV2.search(createViewResponse.id) const response = await config.api.viewV2.search(createViewResponse.id)
expect(response.body.rows).toHaveLength(4) expect(response.body.rows).toHaveLength(4)
expect(response.body).toEqual({ expect(response.body.rows).toEqual(
rows: expected.map(name => expect.objectContaining({ name })), expected.map(name => expect.objectContaining({ name }))
}) )
} }
) )
@ -1320,9 +1331,9 @@ describe.each([
) )
expect(response.body.rows).toHaveLength(4) expect(response.body.rows).toHaveLength(4)
expect(response.body).toEqual({ expect(response.body.rows).toEqual(
rows: expected.map(name => expect.objectContaining({ name })), expected.map(name => expect.objectContaining({ name }))
}) )
} }
) )
@ -1348,7 +1359,9 @@ describe.each([
expect(response.body.rows).toEqual( expect(response.body.rows).toEqual(
expect.arrayContaining( expect.arrayContaining(
rows.map(r => ({ rows.map(r => ({
...expectAnyInternalColsAttributes, ...(isInternal
? expectAnyInternalColsAttributes
: expectAnyExternalColsAttributes),
_viewId: view.id, _viewId: view.id,
name: r.name, name: r.name,
})) }))