Skip to content

Commit

Permalink
Fix #1880 / Add test (#1881)
Browse files Browse the repository at this point in the history
  • Loading branch information
MrCheater authored May 27, 2021
1 parent b713def commit cc6ea98
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const create: UnboundResourceMethod = async (pool, options) => {
`__${options.databaseName}__TRX__`
)}(
"XaKey" VARCHAR(190) NOT NULL,
"XaValue" VARCHAR(190) NOT NULL,
"XaValue" VARCHAR(65535) NOT NULL,
"Timestamp" BIGINT,
PRIMARY KEY("XaKey")
)`,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import create from '../src/resource/create'
import { AdminPool, AdminOptions } from '../src/types'

describe('resource: create', () => {
test('should execute sql including "XaValue" VARCHAR(65535)', async () => {
const inlineLedgerExecuteStatement = jest.fn()
const connect = jest.fn().mockImplementation((admin) => {
admin.inlineLedgerExecuteStatement = inlineLedgerExecuteStatement
})
const disconnect = jest.fn()
const escapeId = (str: string) => str

const pool = ({
connect,
disconnect,
escapeId,
} as unknown) as AdminPool

const options: AdminOptions = {
awsSecretStoreAdminArn: 'awsSecretStoreAdminArn',
dbClusterOrInstanceArn: 'dbClusterOrInstanceArn',
databaseName: 'databaseName',
region: 'region',
userLogin: 'userLogin',
}

await create(pool, options)

expect(inlineLedgerExecuteStatement.mock.calls.join(' ')).toContain(
'"XaValue" VARCHAR(65535)'
)
})
})

0 comments on commit cc6ea98

Please sign in to comment.