Skip to content
This repository has been archived by the owner on Jun 30, 2022. It is now read-only.

Commit

Permalink
test(auth): don't use personal sign in test. not supported by gananche
Browse files Browse the repository at this point in the history
  • Loading branch information
satello committed May 23, 2018
1 parent 12cbaac commit 3ebf1b2
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion tests/integration/storeAuth.test.js
Expand Up @@ -5,13 +5,14 @@ import Kleros from '../../src/kleros'
import * as ethConstants from '../../src/constants/eth'

describe('Auth', () => {
let web3
let loggedInUserAddress

beforeAll(async () => {
const provider = await new Web3.providers.HttpProvider(
ethConstants.LOCALHOST_ETH_PROVIDER
)
const web3 = await new Web3(provider)
web3 = await new Web3(provider)

loggedInUserAddress = web3.eth.accounts[0]
})
Expand Down Expand Up @@ -40,6 +41,16 @@ describe('Auth', () => {
// set new store provider
klerosInstance.auth.setStoreProviderInstance(mockStoreProvider)

// FIXME testrpc/ganache clients don't support personal_sign yet. Remove this mock once they do.
klerosInstance.auth.signMessage = (userAddress, data) =>
new Promise((resolve, reject) => {
web3.eth.sign(userAddress, data, (error, result) => {
if (error) reject(error)

resolve(result)
})
})

const signedToken = await klerosInstance.auth.validateNewAuthToken(
loggedInUserAddress
)
Expand Down

0 comments on commit 3ebf1b2

Please sign in to comment.