@@ -147,6 +147,20 @@ describe('legacy tests', () => {
147
147
} )
148
148
} )
149
149
150
+ test ( 'test_set_event' , done => {
151
+ getNativeDbConnection ( async ( store , db , collection ) => {
152
+ const sid = 'test_set_promise-sid'
153
+ const data = makeData ( )
154
+ store . on ( 'set' , async sessionId => {
155
+ // Verify it was saved
156
+ const session = await collection . findOne ( { _id : sid } )
157
+ assertSessionEquals ( sid , data , session )
158
+ cleanup ( store , collection , done )
159
+ } )
160
+ store . set ( sid , data )
161
+ } )
162
+ } )
163
+
150
164
test ( 'test_set_no_stringify' , done => {
151
165
getNativeDbConnection (
152
166
{ stringify : false } ,
@@ -306,6 +320,22 @@ describe('legacy tests', () => {
306
320
} )
307
321
} )
308
322
323
+ test ( 'test_destroy_ok_event' , done => {
324
+ getNativeDbConnection ( async ( store , db , collection ) => {
325
+ const sid = 'test_destroy_ok_event-sid'
326
+ const testData = { key1 : 1 , key2 : 'two' }
327
+ await collection . insertOne ( {
328
+ _id : sid ,
329
+ session : JSON . stringify ( testData ) ,
330
+ } )
331
+ store . on ( 'destroy' , sessionId => {
332
+ expect ( sessionId ) . toBe ( sid )
333
+ cleanup ( store , collection , done )
334
+ } )
335
+ store . destroy ( sid )
336
+ } )
337
+ } )
338
+
309
339
test ( 'test_clear' , done => {
310
340
getNativeDbConnection ( async ( store , db , collection ) => {
311
341
const sid = 'test_length-sid'
0 commit comments