Skip to content

Commit

Permalink
test: add test case for isUnlocked in MetaMaskInpageProvider.test.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
ffmcgee725 committed Feb 3, 2025
1 parent 7877537 commit 60bb239
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
8 changes: 4 additions & 4 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ const baseConfig = {
// An object that configures minimum threshold enforcement for coverage results
coverageThreshold: {
global: {
branches: 69.23,
functions: 69.64,
lines: 69.23,
statements: 69.38,
branches: 69.63,
functions: 71.42,
lines: 70.27,
statements: 70.4,
},
},

Expand Down
21 changes: 21 additions & 0 deletions src/MetaMaskInpageProvider.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1218,4 +1218,25 @@ describe('MetaMaskInpageProvider: Miscellanea', () => {
expect(provider.selectedAddress).toBe('0xdeadbeef');
});
});

describe('_getExperimentalApi', () => {
let provider: any | MetaMaskInpageProvider;

beforeEach(async () => {
provider = (
await getInitializedProvider({
initialState: {
accounts: ['0xdeadbeef'],
},
})
).provider;
});

describe('isUnlocked', () => {
it('should return negated value of `state.isPermanentlyDisconnected`', async () => {
const isUnlocked = await provider._getExperimentalApi().isUnlocked();
expect(isUnlocked).toBe(!provider._state.isPermanentlyDisconnected);
});
});
});
});

0 comments on commit 60bb239

Please sign in to comment.