Skip to content

Commit 1e7a8af

Browse files
committed
fix(web): icon bundling, runtime errors caught in tests
1 parent 11424f0 commit 1e7a8af

File tree

10 files changed

+52
-20
lines changed

10 files changed

+52
-20
lines changed

apps/web/app/components/icons/bitcoin-icon.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,5 @@ interface BitcoinIconProps extends HTMLStyledProps<'img'> {
44
size?: number;
55
}
66
export function BitcoinIcon({ size = 24 }: BitcoinIconProps) {
7-
return (
8-
<styled.img
9-
width={size}
10-
height={size}
11-
src={'node_modules/@leather.io/ui/dist-web/assets/icons/bitcoin.svg'}
12-
/>
13-
);
7+
return <styled.img width={size} height={size} src="icons/bitcoin.svg" />;
148
}

apps/web/app/components/icons/stacks-icon.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,5 @@ interface StacksIconProps extends HTMLStyledProps<'img'> {
44
size?: number;
55
}
66
export function StacksIcon({ size = 24 }: StacksIconProps) {
7-
return (
8-
<styled.img
9-
width={size}
10-
height={size}
11-
src="node_modules/@leather.io/ui/dist-web/assets/icons/stacks.svg"
12-
/>
13-
);
7+
return <styled.img width={size} height={size} src="icons/stacks.svg" />;
148
}

apps/web/app/layouts/footer/footer.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import { FooterLayout as Footer } from './footer.layout';
22

3-
const year = new Date().getFullYear();
4-
53
function AppFooter() {
64
return (
75
<Footer>
@@ -49,7 +47,9 @@ function AppFooter() {
4947

5048
<Footer.LegalText
5149
product="A Trust Machines product"
52-
copyright={${year} Leather Wallet, LLC`}
50+
// Hard coding date as Cloudflare Workers renders new Date() as epoch
51+
// start time
52+
copyright={`© 2025 Leather Wallet, LLC`}
5353
/>
5454
</Footer>
5555
);

apps/web/app/pages/earn/earn.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { StackingExplainer } from './components/stacking-explainer';
88
export function Earn() {
99
return (
1010
<Page>
11-
<Page.Header title="Earn" />
11+
<Page.Header title="Invest in Stacks" />
1212

1313
<styled.h2 textStyle="heading.05" mt="space.07">
1414
Stack in a pool

apps/web/public/icons/bitcoin.svg

Lines changed: 4 additions & 0 deletions
Loading

apps/web/public/icons/stacks.svg

Lines changed: 5 additions & 0 deletions
Loading

apps/web/tests/earn.spec.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { expect } from '@playwright/test';
2+
3+
import { test } from '.';
4+
5+
test.describe('Earn page', () => {
6+
test('has title', async ({ page }) => {
7+
await page.goto('/earn');
8+
await expect(page.getByRole('heading', { name: 'Invest in Stacks' })).toBeVisible();
9+
});
10+
});

apps/web/tests/homepage.spec.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
import { expect, test } from '@playwright/test';
1+
import { expect } from '@playwright/test';
2+
3+
import { test } from '.';
24

35
test.describe('Homepage', () => {
46
test('has title', async ({ page }) => {

apps/web/tests/index.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { test as base, expect } from '@playwright/test';
2+
3+
export const test = base.extend({
4+
page: async ({ page }, use) => {
5+
const messages: string[] = [];
6+
page.on('console', msg => {
7+
// Ignore regular log messages; we are only interested in errors.
8+
if (msg.type() === 'error') {
9+
messages.push(`[${msg.type()}] ${msg.text()}`);
10+
}
11+
});
12+
// Uncaught (in promise) TypeError + friends are page errors.
13+
page.on('pageerror', error => {
14+
messages.push(`[${error.name}] ${error.message}`);
15+
});
16+
await use(page);
17+
if (messages.length) {
18+
// eslint-disable-next-line no-console
19+
console.log(`Console errors: ${messages.join('\n')}`);
20+
}
21+
expect(messages).toStrictEqual([]);
22+
},
23+
});

eslint.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export default tseslint.config(
4545
},
4646
{
4747
name: 'web',
48-
files: ['apps/web/**/*.{ts,tsx}'],
48+
files: ['apps/web/app/**/*.{ts,tsx}'],
4949
extends: [reactConfig, pluginQuery.configs['flat/recommended']],
5050
},
5151
{

0 commit comments

Comments
 (0)