5
5
runCommonDaoTest ,
6
6
runCommonDBTest ,
7
7
TEST_TABLE ,
8
+ testItemBMJsonSchema ,
8
9
TestItemDBM ,
9
- testItemDBMJsonSchema ,
10
10
} from '@naturalcycles/db-lib/dist/testing'
11
11
import { deflateString , inflateToString , requireEnvKeys } from '@naturalcycles/nodejs-lib'
12
12
import { MysqlDB } from '../mysql.db'
@@ -35,7 +35,7 @@ const db = new MysqlDB({
35
35
} )
36
36
37
37
beforeAll ( async ( ) => {
38
- await db . createTable ( TEST_TABLE , testItemDBMJsonSchema , { dropIfExists : true } )
38
+ await db . createTable ( TEST_TABLE , testItemBMJsonSchema , { dropIfExists : true } )
39
39
} )
40
40
41
41
afterAll ( async ( ) => {
@@ -50,7 +50,7 @@ test('getTableSchema', async () => {
50
50
// console.log(await db.getTables())
51
51
const schema = await db . getTableSchema ( TEST_TABLE )
52
52
console . log ( schema )
53
- expect ( testItemDBMJsonSchema ) . toMatchObject ( schema )
53
+ expect ( testItemBMJsonSchema ) . toMatchObject ( schema )
54
54
} )
55
55
56
56
test ( 'saveBatch overwrite' , async ( ) => {
@@ -82,7 +82,7 @@ test('fieldName with dot', async () => {
82
82
const table = TEST_TABLE + '2'
83
83
84
84
const items = createTestItemsDBM ( 5 ) . map ( r => ( { ...r , [ fieldName ] : 'vv' } ) )
85
- const schema = testItemDBMJsonSchema
85
+ const schema = testItemBMJsonSchema
86
86
schema . properties [ fieldName as keyof TestItemDBM ] = { type : 'string' }
87
87
88
88
await db . createTable ( table , schema , { dropIfExists : true } )
@@ -99,7 +99,7 @@ test('buffer', async () => {
99
99
100
100
const items = createTestItemsDBM ( 5 ) . map ( r => ( { ...r , extra } ) )
101
101
102
- const schema = testItemDBMJsonSchema
102
+ const schema = testItemBMJsonSchema
103
103
schema . properties [ 'extra' as keyof TestItemDBM ] = { instanceof : 'Buffer' }
104
104
105
105
await db . createTable ( table , schema , { dropIfExists : true } )
@@ -114,7 +114,7 @@ test('stringify objects', async () => {
114
114
const item = createTestItemsDBM ( 1 ) [ 0 ] !
115
115
item . k1 = { some : 'obj' , c : 'd' , e : 5 } as any
116
116
117
- await db . createTable ( TEST_TABLE , testItemDBMJsonSchema , { dropIfExists : true } )
117
+ await db . createTable ( TEST_TABLE , testItemBMJsonSchema , { dropIfExists : true } )
118
118
await db . saveBatch ( TEST_TABLE , [ item ] )
119
119
const { rows } = await db . runQuery ( new DBQuery ( TEST_TABLE ) )
120
120
// console.log(rows)
0 commit comments