Skip to content

Commit 4e2fdc3

Browse files
committed
Add test
1 parent a0a2529 commit 4e2fdc3

File tree

2 files changed

+35
-2
lines changed

2 files changed

+35
-2
lines changed

.prettierignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,7 @@ packages/builder/.routify
1010
packages/sdk/sdk
1111
packages/pro/coverage
1212
**/*.ivm.bundle.js
13-
!**/bson-polyfills.ivm.bundle.js
13+
!**/bson-polyfills.ivm.bundle.js
14+
charts/
15+
**/*.hbs
16+
packages/worker/src/constants/templates/tests/

packages/server/src/integration-test/postgres.spec.ts

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
import { Datasource, FieldType, Table } from "@budibase/types"
1+
import {
2+
Datasource,
3+
FieldType,
4+
Table,
5+
StringFieldSubType,
6+
} from "@budibase/types"
27
import { generator } from "@budibase/backend-core/tests"
38
import {
49
DatabaseName,
@@ -279,6 +284,31 @@ if (mainDescriptions.length) {
279284
expect(table?.schema.email.externalType).toBe("USER-DEFINED")
280285
})
281286
})
287+
288+
describe("text[] array field", () => {
289+
const tableName = "textarraytable"
290+
let table: Table
291+
292+
beforeAll(async () => {
293+
await client.raw(`
294+
CREATE TABLE ${tableName} (
295+
id serial PRIMARY KEY,
296+
tags text[]
297+
)
298+
`)
299+
const response = await config.api.datasource.fetchSchema({
300+
datasourceId: datasource._id!,
301+
})
302+
table = response.datasource.entities![tableName]
303+
})
304+
305+
it("should map text[] column to internal type string with array subtype", async () => {
306+
expect(table).toBeDefined()
307+
expect(table?.schema.tags.type).toBe(FieldType.STRING)
308+
expect(table?.schema.tags.subtype).toBe(StringFieldSubType.ARRAY)
309+
expect(table?.schema.tags.externalType).toBe("ARRAY")
310+
})
311+
})
282312
}
283313
)
284314

0 commit comments

Comments
 (0)