Skip to content

Commit

Permalink
Fix joinFederation return type in tests (#89)
Browse files Browse the repository at this point in the history
* fix: types and comments

* fix: joinFederation return type in tests
  • Loading branch information
alexlwn123 authored Oct 23, 2024
1 parent 7b67b6d commit 3c80dd4
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/core-web/src/services/BalanceService.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ beforeAll(async () => {
expect(wallet).toBeDefined()
await expect(
wallet.joinFederation(wallet.testing.TESTING_INVITE, randomTestingId),
).resolves.toBeUndefined()
).resolves.toBe(true)
expect(wallet.isOpen()).toBe(true)

// Cleanup after all tests
Expand Down
5 changes: 5 additions & 0 deletions packages/core-web/src/services/LightningService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ export class LightningService {
})
}

// TODO: Document
subscribeLnClaim(
operationId: string,
onSuccess: (state: LnReceiveState) => void = () => {},
Expand All @@ -104,6 +105,8 @@ export class LightningService {
return unsubscribe
}

// TODO: Document (for external payments only)
// TODO: Make this work for BOTH internal and external payments
subscribeLnPay(
operationId: string,
onSuccess: (state: LnPayState) => void = () => {},
Expand All @@ -120,6 +123,7 @@ export class LightningService {
return unsubscribe
}

// TODO: Document
subscribeLnReceive(
operationId: string,
onSuccess: (state: LnReceiveState) => void = () => {},
Expand All @@ -136,6 +140,7 @@ export class LightningService {
return unsubscribe
}

// TODO: Document
async waitForReceive(operationId: string): Promise<LnReceiveState> {
return new Promise((resolve, reject) => {
let unsubscribe: () => void
Expand Down
2 changes: 1 addition & 1 deletion packages/core-web/src/test/fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const walletTest = test.extend<{
const inviteCode = await wallet.testing.getInviteCode()
await expect(
wallet.joinFederation(inviteCode, randomTestingId),
).resolves.toBeUndefined()
).resolves.toBe(true)

await use(wallet)

Expand Down
2 changes: 1 addition & 1 deletion packages/core-web/src/types/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ type LnPayState =
| { funded: { block_height: number } }
| { waiting_for_refund: { error_reason: string } }
| 'awaiting_change'
| { Success: { preimage: string } }
| { success: { preimage: string } }
| { refunded: { gateway_error: string } }
| { unexpected_error: { error_message: string } }

Expand Down

0 comments on commit 3c80dd4

Please sign in to comment.