Skip to content

Commit

Permalink
cb-730: implemented test cases for getLinkId
Browse files Browse the repository at this point in the history
  • Loading branch information
crossi704 committed May 15, 2020
1 parent 9814dcb commit 5d090d0
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions test/lorena-test.js
Expand Up @@ -26,6 +26,36 @@ describe('Lorena SDK', function () {
lorena = new Lorena(wallet, { debug: true, silent: true })
})

it('getLinkId passing a RoomID', () => {
const roomId = '!eXOzHMhPzOcZyBOogu:matrix.org'
const result = lorena.getLinkId(roomId)
expect(result).to.be.false
})

it('getLinkId passing a LinkID', () => {
const linkId = '123e4567-e89b-12d3-a456-426614174000'
const result = lorena.getLinkId(linkId)
expect(result).to.equal(linkId)
})

it('getLinkId passing an invalid format ID', () => {
const invalidId = '!^&***badjba'
try {
lorena.getLinkId(invalidId)
} catch (error) {
expect(error.message).to.equal('Unsupported ID to getLink')
}
})

it('getLinkId passing an undefined', () => {
const undefinedId = undefined
try {
lorena.getLinkId(undefinedId)
} catch (error) {
expect(error.message).to.equal('Unsupported ID to getLink')
}
})

it('should not init wallet for an invalid network', async () => {
await expect(lorena.initWallet('xxx')).to.be.rejectedWith(Error)
})
Expand Down

0 comments on commit 5d090d0

Please sign in to comment.