@@ -35,7 +35,7 @@ const testsUtil = require('./testsUtil.js');
35
35
36
36
describe ( '178. soda10.js' , ( ) => {
37
37
38
- let conn ;
38
+ let conn , soda ;
39
39
40
40
before ( async function ( ) {
41
41
try {
@@ -46,6 +46,7 @@ describe('178. soda10.js', () => {
46
46
} else {
47
47
await sodaUtil . cleanup ( ) ;
48
48
conn = await oracledb . getConnection ( dbconfig ) ;
49
+ soda = conn . getSodaDatabase ( ) ;
49
50
}
50
51
51
52
} catch ( err ) {
@@ -64,7 +65,6 @@ describe('178. soda10.js', () => {
64
65
65
66
it ( '178.1 basic case of sodaCollection.insertMany()' , async ( ) => {
66
67
try {
67
- let soda = conn . getSodaDatabase ( ) ;
68
68
const COLL = "soda_test_178_1" ;
69
69
const collection = await soda . createCollection ( COLL ) ;
70
70
@@ -98,4 +98,45 @@ describe('178. soda10.js', () => {
98
98
should . not . exist ( err ) ;
99
99
}
100
100
} ) ; // 178.1
101
+
102
+ it . skip ( '178.2 basic case of sodaCollection.insertManyAndGet()' , async ( ) => {
103
+ try {
104
+ const COLL = "soda_test_178_2" ;
105
+ const collection = await soda . createCollection ( COLL ) ;
106
+
107
+ let inContents = [
108
+ { id : 1 , name : "Paul" , office : "Singapore" } ,
109
+ { id : 2 , name : "Emma" , office : "London" } ,
110
+ { id : 3 , name : "Kate" , office : "Edinburgh" } ,
111
+ { id : 4 , name : "Changjie" , office : "Shenzhen" }
112
+ ] ;
113
+ let inDocuments = [ ] ;
114
+ for ( let i = 0 ; i < inContents . length ; i ++ ) {
115
+ inDocuments [ i ] = soda . createDocument ( inContents [ i ] ) ; // n.b. synchronous method
116
+ }
117
+
118
+ let middleDocuments = await collection . insertManyAndGet ( inDocuments ) ;
119
+ let middleContents = [ ] ;
120
+ for ( let i = 0 ; i < middleDocuments . length ; i ++ ) {
121
+ middleContents [ i ] = middleDocuments [ i ] . getContent ( ) ; // n.b. synchronous method
122
+ }
123
+ console . log ( middleContents ) ;
124
+
125
+ // Fetch back
126
+ let outDocuments = await collection . find ( ) . getDocuments ( ) ;
127
+ let outContents = [ ] ;
128
+ for ( let i = 0 ; i < outDocuments . length ; i ++ ) {
129
+ outContents [ i ] = outDocuments [ i ] . getContent ( ) ; // n.b. synchronous method
130
+ }
131
+
132
+ console . log ( outContents ) ;
133
+
134
+ await conn . commit ( ) ;
135
+
136
+ let res = await collection . drop ( ) ;
137
+ should . strictEqual ( res . dropped , true ) ;
138
+ } catch ( err ) {
139
+ should . not . exist ( err ) ;
140
+ }
141
+ } ) ; // 178.2
101
142
} ) ;
0 commit comments