diff --git a/.gitignore b/.gitignore
index f7d330a20..ec94a961b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -19,3 +19,5 @@
.env.production.local
npm-debug.log*
+
+.idea/
diff --git a/src/components/CreateWallet.test.jsx b/src/components/CreateWallet.test.jsx
index 74adcf2fc..6d0c9f3e8 100644
--- a/src/components/CreateWallet.test.jsx
+++ b/src/components/CreateWallet.test.jsx
@@ -34,7 +34,7 @@ describe('', () => {
beforeEach(() => {
const neverResolvingPromise = new Promise(() => {})
apiMock.getGetinfo.mockResolvedValue(neverResolvingPromise)
- apiMock.getSession.mockReturnValue(neverResolvingPromise)
+ apiMock.getSession.mockResolvedValue(neverResolvingPromise)
})
it('should render without errors', () => {
diff --git a/src/components/Wallets.test.jsx b/src/components/Wallets.test.jsx
index 8ab76a5a5..802c78985 100644
--- a/src/components/Wallets.test.jsx
+++ b/src/components/Wallets.test.jsx
@@ -39,10 +39,7 @@ describe('', () => {
beforeEach(() => {
const neverResolvingPromise = new Promise(() => {})
apiMock.getSession.mockResolvedValue(neverResolvingPromise)
- apiMock.getGetinfo.mockResolvedValue({
- ok: true,
- json: () => Promise.resolve({ version: '0.9.10dev' }),
- })
+ apiMock.getGetinfo.mockResolvedValue(neverResolvingPromise)
})
it('should render without errors', () => {
@@ -91,6 +88,10 @@ describe('', () => {
ok: true,
json: () => Promise.resolve({ wallets: [] }),
})
+ apiMock.getGetinfo.mockResolvedValueOnce({
+ ok: true,
+ json: () => Promise.resolve({ version: '0.9.10dev' }),
+ })
act(() => setup({}))
@@ -126,6 +127,10 @@ describe('', () => {
ok: true,
json: () => Promise.resolve({ wallets: ['wallet0.jmdat', 'wallet1.jmdat'] }),
})
+ apiMock.getGetinfo.mockResolvedValueOnce({
+ ok: true,
+ json: () => Promise.resolve({ version: '0.9.10dev' }),
+ })
act(() => setup({}))
@@ -146,6 +151,35 @@ describe('', () => {
expect(importWalletButton.classList.contains('btn-lg')).toBe(false)
})
+ it('should hide "Import Wallet"-button on unsupported backend version', async () => {
+ apiMock.getSession.mockResolvedValueOnce({
+ ok: true,
+ json: () =>
+ Promise.resolve({
+ session: false,
+ maker_running: false,
+ coinjoin_in_process: false,
+ wallet_name: 'None',
+ }),
+ })
+ apiMock.getWalletAll.mockResolvedValueOnce({
+ ok: true,
+ json: () => Promise.resolve({ wallets: [] }),
+ })
+ apiMock.getGetinfo.mockResolvedValueOnce({
+ ok: true,
+ json: () => Promise.resolve({ version: '0.9.9' }),
+ })
+
+ act(() => setup({}))
+
+ expect(screen.getByText('wallets.text_loading')).toBeInTheDocument()
+ await waitForElementToBeRemoved(screen.getByText('wallets.text_loading'))
+
+ expect(screen.queryByTestId('import-wallet-btn')).not.toBeInTheDocument()
+ expect(screen.getByTestId('new-wallet-btn')).toBeInTheDocument()
+ })
+
describe(' lock/unlock flow', () => {
const dummyWalletName = 'dummy.jmdat'
const dummyToken = 'dummyToken'