Renames
This commit is contained in:
parent
05315df183
commit
20ab7fb24d
|
@ -7,7 +7,7 @@ import { InternalTables } from "../../db/utils"
|
||||||
import { TYPE_TRANSFORM_MAP } from "./map"
|
import { TYPE_TRANSFORM_MAP } from "./map"
|
||||||
import { FieldSubtype, Row, RowAttachment, Table } from "@budibase/types"
|
import { FieldSubtype, Row, RowAttachment, Table } from "@budibase/types"
|
||||||
import { cloneDeep } from "lodash/fp"
|
import { cloneDeep } from "lodash/fp"
|
||||||
import { processOutputBBReferences } from "./bbReferenceProcessor"
|
import { processInputBBReferences } from "./bbReferenceProcessor"
|
||||||
export * from "./utils"
|
export * from "./utils"
|
||||||
|
|
||||||
type AutoColumnProcessingOpts = {
|
type AutoColumnProcessingOpts = {
|
||||||
|
@ -169,7 +169,7 @@ export async function inputProcessing(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (field.type === FieldTypes.BB_REFERENCE) {
|
if (field.type === FieldTypes.BB_REFERENCE) {
|
||||||
clonedRow[key] = await processOutputBBReferences(
|
clonedRow[key] = await processInputBBReferences(
|
||||||
value,
|
value,
|
||||||
field.subtype as FieldSubtype
|
field.subtype as FieldSubtype
|
||||||
)
|
)
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { FieldType, FieldTypeSubtypes, Table } from "@budibase/types"
|
||||||
import * as bbReferenceProcessor from "../bbReferenceProcessor"
|
import * as bbReferenceProcessor from "../bbReferenceProcessor"
|
||||||
|
|
||||||
jest.mock("../bbReferenceProcessor", (): typeof bbReferenceProcessor => ({
|
jest.mock("../bbReferenceProcessor", (): typeof bbReferenceProcessor => ({
|
||||||
processOutputBBReferences: jest.fn(),
|
processInputBBReferences: jest.fn(),
|
||||||
}))
|
}))
|
||||||
|
|
||||||
describe("rowProcessor - inputProcessing", () => {
|
describe("rowProcessor - inputProcessing", () => {
|
||||||
|
@ -48,13 +48,13 @@ describe("rowProcessor - inputProcessing", () => {
|
||||||
const user = structures.users.user()
|
const user = structures.users.user()
|
||||||
|
|
||||||
;(
|
;(
|
||||||
bbReferenceProcessor.processOutputBBReferences as jest.Mock
|
bbReferenceProcessor.processInputBBReferences as jest.Mock
|
||||||
).mockResolvedValue(user)
|
).mockResolvedValue(user)
|
||||||
|
|
||||||
const { row } = await inputProcessing(userId, table, newRow)
|
const { row } = await inputProcessing(userId, table, newRow)
|
||||||
|
|
||||||
expect(bbReferenceProcessor.processOutputBBReferences).toBeCalledTimes(1)
|
expect(bbReferenceProcessor.processInputBBReferences).toBeCalledTimes(1)
|
||||||
expect(bbReferenceProcessor.processOutputBBReferences).toBeCalledWith(
|
expect(bbReferenceProcessor.processInputBBReferences).toBeCalledWith(
|
||||||
"123",
|
"123",
|
||||||
"user"
|
"user"
|
||||||
)
|
)
|
||||||
|
@ -96,7 +96,7 @@ describe("rowProcessor - inputProcessing", () => {
|
||||||
|
|
||||||
const { row } = await inputProcessing(userId, table, newRow)
|
const { row } = await inputProcessing(userId, table, newRow)
|
||||||
|
|
||||||
expect(bbReferenceProcessor.processOutputBBReferences).not.toBeCalled()
|
expect(bbReferenceProcessor.processInputBBReferences).not.toBeCalled()
|
||||||
expect(row).toEqual({ ...newRow, user: undefined })
|
expect(row).toEqual({ ...newRow, user: undefined })
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ describe("rowProcessor - inputProcessing", () => {
|
||||||
|
|
||||||
const { row } = await inputProcessing(userId, table, newRow)
|
const { row } = await inputProcessing(userId, table, newRow)
|
||||||
|
|
||||||
expect(bbReferenceProcessor.processOutputBBReferences).not.toBeCalled()
|
expect(bbReferenceProcessor.processInputBBReferences).not.toBeCalled()
|
||||||
expect(row).toEqual({
|
expect(row).toEqual({
|
||||||
name: "Jack",
|
name: "Jack",
|
||||||
user: 123,
|
user: 123,
|
||||||
|
|
Loading…
Reference in New Issue