Skip to content

Commit

Permalink
test "no boxer installed"
Browse files Browse the repository at this point in the history
  • Loading branch information
mixmix committed Apr 9, 2024
1 parent f2d2ab4 commit 2efce41
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/db2.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ test('db2', async t => {
.catch((err) => {
t.match(err.message, /recps-guard: public messages of type "profile" not allowed/, 'public blocked')
})

await p(server.tribes.publish)(content)
.then(msg => t.error(msg, "shouldn't get msg on err"))
.catch((err) => {
Expand Down
52 changes: 52 additions & 0 deletions test/no-boxer.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
const { promisify: p } = require('util')
const test = require('tape')

const Server = require('scuttle-testbot')

test('no-boxer', async t => {
{
const ssb = Server // eslint-disable-line
.use(require('../')) // ssb-recps-guard
.call(null, {
db1: true
})

await p(ssb.publish)({ type: 'hello', recps: [ssb.id] })
.then(res => t.fail('should fail'))
.catch(err => { // eslint-disable-line
t.pass('should fail')
// console.log(err)
})

await p(ssb.close)(true)
}

{
const ssb = Server // eslint-disable-line
.use(require('ssb-db2/core'))
.use(require('ssb-classic'))
.use(require('ssb-db2/compat'))
.use(require('ssb-db2/compat/feedstate'))
// .use(require('ssb-box2'))
// .use(require('ssb-tribes'))
.use(require('../')) // ssb-recps-guard
.call(null, {
noDefaultUse: true,
box2: {
legacyMode: true
}
})

const content = { type: 'hello', recps: [ssb.id] }
await p(ssb.db.create)({ content, encryptionFormat: 'box2' })
.then(res => t.fail('should fail'))
.catch(err => { // eslint-disable-line
t.pass('should fail')
// console.log(err)
})

await p(ssb.close)(true)
}

t.end()
})

0 comments on commit 2efce41

Please sign in to comment.