add failing test

This commit is contained in:
Sam Rose 2024-10-02 09:35:47 +01:00
parent 77856eb35a
commit cc6b2f6717
No known key found for this signature in database
1 changed files with 26 additions and 0 deletions

View File

@ -25,6 +25,7 @@ import {
ViewFieldMetadata,
FeatureFlag,
BBReferenceFieldSubType,
ViewCalculationFieldMetadata,
} from "@budibase/types"
import { generator, mocks } from "@budibase/backend-core/tests"
import { DatabaseName, getDatasource } from "../../../integrations/tests/utils"
@ -540,6 +541,31 @@ describe.each([
status: 201,
})
})
it.only("can create a view with calculation fields", async () => {
let view = await config.api.viewV2.create({
tableId: table._id!,
name: generator.guid(),
schema: {
sum: {
visible: true,
calculationType: CalculationType.SUM,
field: "Price",
},
},
})
let sum = view.schema!.sum as ViewCalculationFieldMetadata
expect(sum).toBeDefined()
expect(sum.calculationType).toEqual(CalculationType.SUM)
expect(sum.field).toEqual("Price")
view = await config.api.viewV2.get(view.id)
sum = view.schema!.sum as ViewCalculationFieldMetadata
expect(sum).toBeDefined()
expect(sum.calculationType).toEqual(CalculationType.SUM)
expect(sum.field).toEqual("Price")
})
})
describe("update", () => {