Skip to content

Commit

Permalink
Merge pull request #6 from lorena-ssi/cb-260-add-setKeyring-to-interface
Browse files Browse the repository at this point in the history
Added setKeyring to Blockchain interface
  • Loading branch information
crossi704 committed Apr 24, 2020
2 parents a9633e1 + cedac8b commit ae02708
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/index.js
Expand Up @@ -8,6 +8,9 @@ module.exports = class BlockchainInterface {
if (!this.connect) {
/* istanbul ignore next */
throw new Error('Blockchain must have function `connect`!')
} else if (!this.setKeyring) {
/* istanbul ignore next */
throw new Error('Blockchain must have function `setKeyring`!')
} else if (!this.disconnect) {
/* istanbul ignore next */
throw new Error('Blockchain must have function `disconnect`!')
Expand Down
20 changes: 20 additions & 0 deletions test/blockchain-test.js
Expand Up @@ -11,6 +11,7 @@ describe('Lorena Blockchain interface', function () {
class TestBlockchain extends BlockchainInterface {
connect () {}
disconnect () {}
setKeyring () {}
registerDid () {}
getActualDidKey () {}
registerDidDocument () {}
Expand All @@ -25,6 +26,7 @@ describe('Lorena Blockchain interface', function () {
it('Should generate a correct class if some methods are async', () => {
class TestBlockchain extends BlockchainInterface {
disconnect () {}
setKeyring () {}
registerDid () {}
getActualDidKey () {}
registerDidDocument () {}
Expand All @@ -37,6 +39,7 @@ describe('Lorena Blockchain interface', function () {
it('Should generate a correct class if some methods are async', () => {
class TestBlockchain extends BlockchainInterface {
connect () {}
setKeyring () {}
registerDid () {}
getActualDidKey () {}
registerDidDocument () {}
Expand All @@ -50,6 +53,19 @@ describe('Lorena Blockchain interface', function () {
class TestBlockchain extends BlockchainInterface {
connect () {}
disconnect () {}
registerDid () {}
getActualDidKey () {}
registerDidDocument () {}
getDidDocHash () {}
}
(() => new TestBlockchain()).should.throw(Error, 'Blockchain must have function `setKeyring`!')
})

it('Should generate a correct class if some methods are async', () => {
class TestBlockchain extends BlockchainInterface {
connect () {}
disconnect () {}
setKeyring () {}
getActualDidKey () {}
registerDidDocument () {}
getDidDocHash () {}
Expand All @@ -62,6 +78,7 @@ describe('Lorena Blockchain interface', function () {
class TestBlockchain extends BlockchainInterface {
connect () {}
disconnect () {}
setKeyring () {}
registerDid () {}
registerDidDocument () {}
getDidDocHash () {}
Expand All @@ -74,6 +91,7 @@ describe('Lorena Blockchain interface', function () {
class TestBlockchain extends BlockchainInterface {
connect () {}
disconnect () {}
setKeyring () {}
registerDid () {}
getActualDidKey () {}
getDidDocHash () {}
Expand All @@ -86,6 +104,7 @@ describe('Lorena Blockchain interface', function () {
class TestBlockchain extends BlockchainInterface {
connect () {}
disconnect () {}
setKeyring () {}
registerDid () {}
getActualDidKey () {}
registerDidDocument () {}
Expand All @@ -98,6 +117,7 @@ describe('Lorena Blockchain interface', function () {
class TestBlockchain extends BlockchainInterface {
connect () {}
disconnect () {}
setKeyring () {}
registerDid () {}
getActualDidKey () {}
registerDidDocument () {}
Expand Down

0 comments on commit ae02708

Please sign in to comment.