/* Copyright (c) 2014 Richard Rodger, MIT License */
'use strict'

var Seneca = require('seneca')
var MemStore = require('seneca-mem-store')
var Shared = require('..')

var Lab = require('@hapi/lab')
var lab = (exports.lab = Lab.script())
var before = lab.before

var si = Seneca({
  default_plugins: { 'mem-store': false },
}).test()

si.use(MemStore)

var merge = Seneca({
  default_plugins: { 'mem-store': false },
}).test()

merge.use(MemStore, { merge: false })

if (si.version >= '2.0.0') {
  si.use('entity')
  merge.use('entity')
}

Shared.basictest({
  seneca: si,
  senecaMerge: merge,
  script: lab,
})

Shared.sorttest({
  seneca: si,
  script: lab,
})

Shared.limitstest({
  seneca: si,
  script: lab,
})

Shared.upserttest({
  seneca: si,
  script: lab
})


@@ -308,33 +308,32 @@
 -store': false %7D
-,
 %0A%7D).test()%0A%0Asi.u
@@ -332,26 +332,8 @@
 ()%0A%0A
-si.use(MemStore)%0A%0A
 var 
@@ -390,17 +390,16 @@
  false %7D
-,
 %0A%7D).test
@@ -406,47 +406,8 @@
 ()%0A%0A
-merge.use(MemStore, %7B merge: false %7D)%0A%0A
 if (
@@ -475,16 +475,72 @@
 ty')%0A%7D%0A%0A
+si.use(MemStore)%0Amerge.use(MemStore, %7B merge: false %7D)%0A%0A
 Shared.b
@@ -591,33 +591,32 @@
 e,%0A  script: lab
-,
 %0A%7D)%0A%0AShared.sort
@@ -641,33 +641,32 @@
 i,%0A  script: lab
-,
 %0A%7D)%0A%0AShared.limi
@@ -701,17 +701,16 @@
 ipt: lab
-,
 %0A%7D)%0A%0ASha

Fix a bug in tests