Skip to content

Commit 8ed2924

Browse files
authored
test: ensure unit tests run in CI, fix failing tests (#1091)
1 parent a8903e0 commit 8ed2924

3 files changed

Lines changed: 23 additions & 21 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"test:e2e:chrome": "playwright test --project=chrome",
2424
"test:e2e:msedge": "playwright test --project=msedge",
2525
"test:e2e:report": "playwright show-report tests/e2e/playwright-report",
26-
"test:ci": "pnpm test -- --reporters=default --reporters=github-actions"
26+
"test:ci": "jest --reporters=default --reporters=github-actions"
2727
},
2828
"dependencies": {
2929
"@interledger/open-payments": "^7.0.0",

src/background/utils.test.ts

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -125,12 +125,12 @@ describe('convertWithExchangeRate', () => {
125125
to: 'GBP',
126126
amounts: [
127127
{ input: '1', expected: '1' },
128-
{ input: '10', expected: '9' },
128+
{ input: '10', expected: '8' },
129129
{ input: '100', expected: '81' },
130130
{ input: '10000', expected: '8065' },
131-
{ input: '15', expected: '13' },
131+
{ input: '15', expected: '12' },
132132
{ input: '2', expected: '2' },
133-
{ input: '200', expected: '162' },
133+
{ input: '200', expected: '161' },
134134
],
135135
},
136136
{
@@ -140,12 +140,12 @@ describe('convertWithExchangeRate', () => {
140140
amounts: [
141141
{ input: '1', expected: '1' },
142142
{ input: '10', expected: '10' },
143-
{ input: '100', expected: '97' },
144-
{ input: '10000', expected: '9616' },
145-
{ input: '15', expected: '15' },
143+
{ input: '100', expected: '96' },
144+
{ input: '10000', expected: '9615' },
145+
{ input: '15', expected: '14' },
146146
{ input: '2', expected: '2' },
147-
{ input: '200', expected: '193' },
148-
{ input: 200n, expected: 193n },
147+
{ input: '200', expected: '192' },
148+
{ input: 200n, expected: 192n },
149149
],
150150
},
151151
{
@@ -156,11 +156,11 @@ describe('convertWithExchangeRate', () => {
156156
{ input: '1', expected: '21' },
157157
{ input: '10', expected: '206' },
158158
{ input: '100', expected: '2058' },
159-
{ input: '10000', expected: '205762' },
159+
{ input: '10000', expected: '205761' },
160160
{ input: '15', expected: '309' },
161-
{ input: '2', expected: '42' },
162-
{ input: '200', expected: '4116' },
163-
{ input: 200n, expected: 4116n },
161+
{ input: '2', expected: '41' },
162+
{ input: '200', expected: '4115' },
163+
{ input: 200n, expected: 4115n },
164164
],
165165
},
166166
{
@@ -183,12 +183,12 @@ describe('convertWithExchangeRate', () => {
183183
from: 'GBP',
184184
to: 'USD',
185185
amounts: [
186-
{ input: '1', expected: '2' },
187-
{ input: '10', expected: '13' },
186+
{ input: '1', expected: '1' },
187+
{ input: '10', expected: '12' },
188188
{ input: '100', expected: '124' },
189189
{ input: '10000', expected: '12400' },
190190
{ input: '15', expected: '19' },
191-
{ input: '2', expected: '3' },
191+
{ input: '2', expected: '2' },
192192
{ input: '200', expected: '248' },
193193
],
194194
},
@@ -198,13 +198,13 @@ describe('convertWithExchangeRate', () => {
198198
to: 'JPY',
199199
toAssetScale: 3,
200200
amounts: [
201-
{ input: '1', expected: '1539' },
201+
{ input: '1', expected: '1538' },
202202
{ input: '10', expected: '15385' },
203-
{ input: '100', expected: '153847' },
204-
{ input: '10000', expected: '15384616' },
203+
{ input: '100', expected: '153846' },
204+
{ input: '10000', expected: '15384615' },
205205
{ input: '15', expected: '23077' },
206206
{ input: '2', expected: '3077' },
207-
{ input: '200', expected: '307693' },
207+
{ input: '200', expected: '307692' },
208208
],
209209
},
210210
];

src/content/__tests__/monetizationLinkManager.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1172,7 +1172,9 @@ describe('document events', () => {
11721172
await nextTick();
11731173

11741174
const requestId = 'uuid-1';
1175-
expect(msg.STOP_MONETIZATION).toHaveBeenCalledWith([{ requestId }]);
1175+
expect(msg.STOP_MONETIZATION).toHaveBeenCalledWith([
1176+
{ requestId, intent: 'pause' },
1177+
]);
11761178

11771179
documentVisibilityState.mockReturnValueOnce('visible');
11781180
document.dispatchEvent(new window.Event('visibilitychange'));

0 commit comments

Comments
 (0)