Skip to content

Commit

Permalink
fix: rename method
Browse files Browse the repository at this point in the history
  • Loading branch information
neekolas committed Sep 8, 2023
1 parent 6e1f7a4 commit ac1372b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 18 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"test:setup": "./dev/up",
"test:teardown": "./dev/down",
"test": "npm run test:node",
"test:node": "jest --no-cache --config ./jest.config.cjs --testTimeout=30000",
"test:node": "jest --no-cache --env='node' --testTimeout=30000",
"test:jsdom": "jest --no-cache --env='./jest.jsdom.env.cjs' --testTimeout=30000",
"test:cov": "jest --coverage --no-cache --runInBand",
"lint": "prettier --check . && eslint .",
Expand Down
13 changes: 2 additions & 11 deletions src/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -351,17 +351,8 @@ export default class Client {
* Right now, this is only true if the user has Metamask with Snaps
* and has enabled the `useSnaps` option
*/
static async canGetKeys(
wallet: Signer | null,
opts?: Partial<ClientOptions>
) {
if (!defaultOptions(opts).useSnaps) {
return true
}

const isSnapCompatible = await hasMetamaskWithSnaps()

return !isSnapCompatible
static isSnapsReady() {
return hasMetamaskWithSnaps()
}

private static async setupBackupClient(
Expand Down
11 changes: 5 additions & 6 deletions test/Client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -377,16 +377,15 @@ describe('ClientOptions', () => {

describe('canGetKeys', () => {
it('returns true if the useSnaps flag is false', async () => {
const canGetKeys = await Client.canGetKeys(newWallet(), {})
expect(canGetKeys).toBe(true)
mockEthRequest.mockRejectedValue(new Error('foo'))
const isSnapsReady = await Client.isSnapsReady()
expect(isSnapsReady).toBe(false)
})

it('returns false if the user has a Snaps capable browser and snaps are enabled', async () => {
mockEthRequest.mockResolvedValue([])
const canGetKeys = await Client.canGetKeys(newWallet(), {
useSnaps: true,
})
expect(canGetKeys).toBe(false)
const isSnapsReady = await Client.isSnapsReady()
expect(isSnapsReady).toBe(true)
})
})
})

0 comments on commit ac1372b

Please sign in to comment.