Skip to content

Commit

Permalink
Move test-inputs.ts into src/ to check types of fixtures
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaw3d committed Nov 17, 2023
1 parent b8f2992 commit 184252f
Show file tree
Hide file tree
Showing 15 changed files with 24 additions and 19 deletions.
2 changes: 1 addition & 1 deletion playwright/tests/extension.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { warnSlowApi } from '../utils/warnSlowApi'
import { mockApi } from '../utils/mockApi'
import { expectNoErrorsInConsole } from '../utils/expectNoErrorsInConsole'
import { fillPrivateKeyWithoutPassword } from '../utils/fillPrivateKey'
import { privateKey, privateKeyAddress } from '../utils/test-inputs'
import { privateKey, privateKeyAddress } from '../../src/utils/__fixtures__/test-inputs'

// Test dev build by default, but also allow testing production
const extensionPath = path.join(__dirname, '..', process.env.EXTENSION_PATH ?? '../build-dev/')
Expand Down
2 changes: 1 addition & 1 deletion playwright/tests/fiat.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { test, expect, Page } from '@playwright/test'
import { privateKey, privateKeyAddress } from '../utils/test-inputs'
import { privateKey, privateKeyAddress } from '../../src/utils/__fixtures__/test-inputs'
import { fillPrivateKeyWithoutPassword } from '../utils/fillPrivateKey'
import { warnSlowApi } from '../utils/warnSlowApi'
import { mockApi } from '../utils/mockApi'
Expand Down
2 changes: 1 addition & 1 deletion playwright/tests/migrating-persisted-state.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { mockApi } from '../utils/mockApi'
import { warnSlowApi } from '../utils/warnSlowApi'
import { expectNoFatal } from '../utils/expectNoFatal'
import { addPersistedStorage, clearPersistedStorage } from '../utils/storage'
import { password, privateKeyUnlockedState } from '../utils/test-inputs'
import { password, privateKeyUnlockedState } from '../../src/utils/__fixtures__/test-inputs'
import { RootState } from '../../src/types/RootState'

test.beforeEach(async ({ context, page }) => {
Expand Down
2 changes: 1 addition & 1 deletion playwright/tests/paraTimes.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { test, expect } from '@playwright/test'
import { privateKey, privateKeyAddress } from '../utils/test-inputs'
import { privateKey, privateKeyAddress } from '../../src/utils/__fixtures__/test-inputs'
import { fillPrivateKeyWithoutPassword } from '../utils/fillPrivateKey'
import { warnSlowApi } from '../utils/warnSlowApi'
import { mockApi } from '../utils/mockApi'
Expand Down
2 changes: 1 addition & 1 deletion playwright/tests/persist.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
privateKey2,
password,
wrongPassword,
} from '../utils/test-inputs'
} from '../../src/utils/__fixtures__/test-inputs'
import { fillPrivateKeyWithoutPassword, fillPrivateKeyAndPassword } from '../utils/fillPrivateKey'

test.beforeEach(async ({ context, page }) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect, chromium } from '@playwright/test'
import { mnemonic, password, privateKey } from '../../utils/test-inputs'
import { mnemonic, password, privateKey } from '../../../src/utils/__fixtures__/test-inputs'
import { warnSlowApi } from '../../utils/warnSlowApi'
import { mockApi } from '../../utils/mockApi'
import {
Expand Down
2 changes: 1 addition & 1 deletion playwright/tests/preventSavingInputsToDisk/firefox.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect, firefox } from '@playwright/test'
import { mnemonic, password, privateKey } from '../../utils/test-inputs'
import { mnemonic, password, privateKey } from '../../../src/utils/__fixtures__/test-inputs'
import { warnSlowApi } from '../../utils/warnSlowApi'
import { mockApi } from '../../utils/mockApi'
import {
Expand Down
2 changes: 1 addition & 1 deletion playwright/tests/refreshing-balance.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { test, expect } from '@playwright/test'
import { privateKey, privateKeyAddress } from '../utils/test-inputs'
import { privateKey, privateKeyAddress } from '../../src/utils/__fixtures__/test-inputs'
import { fillPrivateKeyWithoutPassword } from '../utils/fillPrivateKey'
import { warnSlowApi } from '../utils/warnSlowApi'
import { mockApi } from '../utils/mockApi'
Expand Down
2 changes: 1 addition & 1 deletion playwright/tests/syncTabs.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
privateKey2,
privateKey2AddressPretty,
mnemonic,
} from '../utils/test-inputs'
} from '../../src/utils/__fixtures__/test-inputs'
import { addPersistedStorage, clearPersistedStorage } from '../utils/storage'
import { fillPrivateKeyWithoutPassword, fillPrivateKeyAndPassword } from '../utils/fillPrivateKey'
import type { AccountsRow } from '../../src/vendors/oasisscan/index'
Expand Down
8 changes: 7 additions & 1 deletion playwright/tests/toolbar.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import { test, expect, Page } from '@playwright/test'
import { mnemonic, mnemonicAddress0, password, privateKey, privateKeyAddress } from '../utils/test-inputs'
import {
mnemonic,
mnemonicAddress0,
password,
privateKey,
privateKeyAddress,
} from '../../src/utils/__fixtures__/test-inputs'
import { fillPrivateKeyAndPassword } from '../utils/fillPrivateKey'
import { warnSlowApi } from '../utils/warnSlowApi'
import { mockApi } from '../utils/mockApi'
Expand Down
2 changes: 1 addition & 1 deletion playwright/tests/validators.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { test, expect } from '@playwright/test'
import { privateKey, privateKeyAddress } from '../utils/test-inputs'
import { privateKey, privateKeyAddress } from '../../src/utils/__fixtures__/test-inputs'
import { fillPrivateKeyWithoutPassword } from '../utils/fillPrivateKey'
import { warnSlowApi } from '../utils/warnSlowApi'
import { mockApi } from '../utils/mockApi'
Expand Down
2 changes: 1 addition & 1 deletion playwright/utils/fillPrivateKey.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect, test, Page } from '@playwright/test'
import { password, privateKey, privateKeyAddress } from './test-inputs'
import { password, privateKey, privateKeyAddress } from '../../src/utils/__fixtures__/test-inputs'

export async function fillPrivateKeyWithoutPassword(
page: Page,
Expand Down
2 changes: 1 addition & 1 deletion playwright/utils/storage.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Page } from '@playwright/test'
import { privateKeyPersistedState } from './test-inputs'
import { privateKeyPersistedState } from '../../src/utils/__fixtures__/test-inputs'

export async function clearPersistedStorage(page: Page) {
// Move to the right domain, but don't needlessly load HTML and JS.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { ImportAccountsStep } from '../../src/app/state/importaccounts/types'
import type { TransactionFormSteps } from '../../src/app/state/paratimes/types'
import type { WalletType } from '../../src/app/state/wallet/types'
import type { RootState } from '../../src/types/RootState'
import type { ImportAccountsStep } from 'app/state/importaccounts/types'
import type { TransactionFormSteps } from 'app/state/paratimes/types'
import type { WalletType } from 'app/state/wallet/types'
import type { RootState } from 'types'

export const mnemonicAddress0 = 'oasis1qqca0gplrfn63ljg9c833te7em36lkz0cv8djffh'
export const mnemonicAddress0Pretty = 'oasis1 qqca 0gpl rfn6 3ljg 9c83 3te7 em36 lkz0 cv8d jffh'
Expand Down Expand Up @@ -132,5 +132,4 @@ export const privateKeyUnlockedState = {
}),
enteredWrongPassword: false,
},
// TODO: this doesn't check types?!
} satisfies RootState
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import browser from 'webextension-polyfill'
import { openLedgerAccessPopup } from './webextension'
import { openLedgerAccessPopup } from '../webextension'

jest.mock('webextension-polyfill', () => ({
extension: {
Expand Down

0 comments on commit 184252f

Please sign in to comment.