Skip to content

Commit 98a99c6

Browse files
author
Benjamin Forster
committed
fix prefixes to translate node value to string.
1 parent 48c8de6 commit 98a99c6

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

lib/prefixes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ function fromKey (key) {
1313
function fromNodes (nodes) {
1414
return {
1515
prefix: fromKey(nodes[0].key),
16-
uri: nodes[0].value
16+
uri: nodes[0].value.toString()
1717
}
1818
}
1919

test/prefixes.spec.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ describe('prefix utilities', () => {
1717

1818
describe('fromNodes', () => {
1919
it('converts hyperdb nodes to prefix/uri object', () => {
20-
const dummyNodes = [{ key: '@prefix/this', value: 'http://this.example.com' }]
20+
const dummyNodes = [{ key: '@prefix/this', value: Buffer.from('http://this.example.com') }]
2121
expect(prefixes.fromNodes(dummyNodes)).to.eql({ uri: 'http://this.example.com', prefix: 'this' })
2222
})
2323
it('ignores conflicts', () => {
2424
const dummyNodes = [
25-
{ key: '@prefix/this', value: 'http://this.example.com' },
26-
{ key: '@prefix/this', value: 'http://conflict.example.com' }
25+
{ key: '@prefix/this', value: Buffer.from('http://this.example.com') },
26+
{ key: '@prefix/this', value: Buffer.from('http://conflict.example.com') }
2727
]
2828
expect(prefixes.fromNodes(dummyNodes)).to.eql({ uri: 'http://this.example.com', prefix: 'this' })
2929
})

0 commit comments

Comments
 (0)