mirror of
https://github.com/fluencelabs/js-libp2p-interfaces
synced 2025-04-25 04:52:18 +00:00
36 lines
763 B
JavaScript
36 lines
763 B
JavaScript
|
/* eslint-env mocha */
|
||
|
|
||
|
'use strict'
|
||
|
|
||
|
const chai = require('chai')
|
||
|
const expect = chai.expect
|
||
|
chai.use(require('dirty-chai'))
|
||
|
|
||
|
module.exports = (test) => {
|
||
|
describe('record', () => {
|
||
|
let record
|
||
|
|
||
|
beforeEach(async () => {
|
||
|
record = await test.setup()
|
||
|
if (!record) throw new Error('missing record')
|
||
|
})
|
||
|
|
||
|
afterEach(() => test.teardown())
|
||
|
|
||
|
it('has domain and codec', () => {
|
||
|
expect(record.domain).to.exist()
|
||
|
expect(record.codec).to.exist()
|
||
|
})
|
||
|
|
||
|
it('is able to marshal', () => {
|
||
|
const rawData = record.marshal()
|
||
|
expect(Buffer.isBuffer(rawData)).to.eql(true)
|
||
|
})
|
||
|
|
||
|
it('is able to compare two records', () => {
|
||
|
const equals = record.equals(record)
|
||
|
expect(equals).to.eql(true)
|
||
|
})
|
||
|
})
|
||
|
}
|