Skip to content

Commit

Permalink
chore: run prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
devceline committed Jan 13, 2024
1 parent 7488728 commit 4b046a2
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 38 deletions.
20 changes: 10 additions & 10 deletions playwright.config.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { defineConfig, devices } from '@playwright/test';
import { defineConfig, devices } from '@playwright/test'

/**
* Read environment variables from file.
* https://github.com/motdotla/dotenv
*/
// require('dotenv').config();

const baseURL = 'http://localhost:5173';
const baseURL = 'http://localhost:5173'

/**
* See https://playwright.dev/docs/test-configuration.
Expand All @@ -31,25 +31,25 @@ export default defineConfig({
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',

screenshot: 'only-on-failure',
screenshot: 'only-on-failure'
},

/* Configure projects for major browsers */
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
use: { ...devices['Desktop Chrome'] }
},

{
name: 'firefox',
use: { ...devices['Desktop Firefox'] },
use: { ...devices['Desktop Firefox'] }
},

{
name: 'webkit',
use: { ...devices['Desktop Safari'] },
},
use: { ...devices['Desktop Safari'] }
}

/* Test against mobile viewports. */
// {
Expand All @@ -76,6 +76,6 @@ export default defineConfig({
webServer: {
command: 'yarn dev',
url: baseURL,
reuseExistingServer: !process.env.CI,
},
});
reuseExistingServer: !process.env.CI
}
})
20 changes: 11 additions & 9 deletions src/contexts/W3iContext/hooks/notifyHooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ export const useNotifyState = (w3iProxy: Web3InboxProxy, proxyReady: boolean) =>
* load in progress state using interval until it is
*/
useEffect(() => {
if(watchSubscriptionsComplete) {
return noop;
if (watchSubscriptionsComplete) {
return noop
}
// Account for sync init
const intervalId = setInterval(() => {
if (notifyClient?.hasFinishedInitialLoad()) {
setWatchSubscriptionsComplete(true)
return noop;
}
if (notifyClient?.hasFinishedInitialLoad()) {
setWatchSubscriptionsComplete(true)
return noop
}
refreshNotifyState()
}, 100)

Expand All @@ -69,10 +69,12 @@ export const useNotifyState = (w3iProxy: Web3InboxProxy, proxyReady: boolean) =>
const handleUnregisterOthers = useCallback(
async (key: string) => {
if (!(notifyClient && key && uiEnabled.notify)) {
return
return
}
await notifyClient.unregisterOtherAccounts(key);
}, [notifyClient])
await notifyClient.unregisterOtherAccounts(key)
},
[notifyClient]
)

const handleRegistration = useCallback(
async (key: string) => {
Expand Down
4 changes: 2 additions & 2 deletions src/w3iProxy/notifyProviders/externalNotifyProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,12 @@ export default class ExternalNotifyProvider implements W3iNotifyProvider {

public async unregisterOtherAccounts() {
// TODO: remove this whole provider
return
return
}

public async unregister() {
// TODO: remove this whole provider
return
return
}

public async register() {
Expand Down
15 changes: 7 additions & 8 deletions src/w3iProxy/notifyProviders/internalNotifyProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ export default class InternalNotifyProvider implements W3iNotifyProvider {
// Ensure we have a registration with echo (if we need it)
this.ensureEchoRegistration()
updateSymkeyState()


}

// ------------------------ Provider-specific methods ------------------------
Expand Down Expand Up @@ -110,7 +108,7 @@ export default class InternalNotifyProvider implements W3iNotifyProvider {
return this.notifyClient?.hasFinishedInitialLoad() || false
}

public async unregister(params: {account: string}) {
public async unregister(params: { account: string }) {
if (!this.notifyClient) {
throw new Error(this.formatClientRelatedError('unregister'))
}
Expand Down Expand Up @@ -260,12 +258,13 @@ export default class InternalNotifyProvider implements W3iNotifyProvider {
throw new Error(this.formatClientRelatedError('unregisterOtherAccounts'))
}

const otherAccounts = this.notifyClient.identityKeys.identityKeys.getAll()
.map(({accountId}) => accountId)
.filter(account => account !== currentAccount);
const otherAccounts = this.notifyClient.identityKeys.identityKeys
.getAll()
.map(({ accountId }) => accountId)
.filter(account => account !== currentAccount)

for(const account of otherAccounts) {
await this.notifyClient.unregister({account})
for (const account of otherAccounts) {
await this.notifyClient.unregister({ account })
}
}
}
4 changes: 2 additions & 2 deletions src/w3iProxy/w3iNotifyFacade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class W3iNotifyFacade implements W3iNotify {

// ------------------ Notify Client Forwarding ------------------

public async unregister(params: { account: string; }) {
public async unregister(params: { account: string }) {
return this.provider.unregister(params)
}

Expand Down Expand Up @@ -102,7 +102,7 @@ class W3iNotifyFacade implements W3iNotify {
}

public async unregisterOtherAccounts(currentAccount: string) {
this.provider.unregisterOtherAccounts(currentAccount);
this.provider.unregisterOtherAccounts(currentAccount)
}
}

Expand Down
14 changes: 7 additions & 7 deletions tests/home.spec.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { test, expect } from '@playwright/test';
import { expect, test } from '@playwright/test'

test('has title', async ({ page }) => {
await page.goto("/");
await expect(page).toHaveTitle(/Web3Inbox/);
});
await page.goto('/')
await expect(page).toHaveTitle(/Web3Inbox/)
})

test('welcome message', async ({ page }) => {
await page.goto("/");
await expect(page.getByText("Welcome to Web3Inbox")).toBeVisible();
});
await page.goto('/')
await expect(page.getByText('Welcome to Web3Inbox')).toBeVisible()
})

0 comments on commit 4b046a2

Please sign in to comment.