Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into chore/transaction-i…
Browse files Browse the repository at this point in the history
…ndexes
  • Loading branch information
rolznz committed Jul 20, 2024
2 parents d7f9a59 + d8ba374 commit 7b7573e
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
with:
go-version-file: "./go.mod"
- name: Run tests
run: mkdir frontend/dist && touch frontend/dist/tmp && go test -race ./...
run: mkdir frontend/dist && touch frontend/dist/tmp && go test ./...
- name: Docker build
if: github.actor != 'dependabot[bot]'
uses: mr-smithers-excellent/docker-build-push@v6
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/http.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
node-version: "20.x"

- name: Run tests
run: mkdir frontend/dist && touch frontend/dist/tmp && go test -race ./...
run: mkdir frontend/dist && touch frontend/dist/tmp && go test ./...

- name: Build frontend
run: |
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,11 @@ _If you get a blank screen, try running in your normal terminal (outside of vsco

### Testing

$ go test -race ./...
$ go test ./...

#### Test matching regular expression

$ go test -race ./... -run TestHandleGetInfoEvent
$ go test ./... -run TestHandleGetInfoEvent

### Profiling

Expand Down
17 changes: 17 additions & 0 deletions nip47/controllers/multi_pay_invoice_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,15 @@ func TestHandleMultiPayInvoiceEvent_OneMalformedInvoice(t *testing.T) {
HandleMultiPayInvoiceEvent(ctx, nip47Request, requestEvent.ID, app, publishResponse)

assert.Equal(t, 2, len(responses))
assert.Equal(t, 2, len(dTags))

// we can't guarantee which request was processed first
// so swap them if they are back to front
if responses[0].Result != nil {
responses[0], responses[1] = responses[1], responses[0]
dTags[0], dTags[1] = dTags[1], dTags[0]
}

assert.Equal(t, "invoiceId123", dTags[0].GetFirst([]string{"d"}).Value())
assert.Equal(t, models.ERROR_INTERNAL, responses[0].Error.Code)
assert.Nil(t, responses[0].Result)
Expand Down Expand Up @@ -224,6 +233,14 @@ func TestHandleMultiPayInvoiceEvent_IsolatedApp_OneBudgetExceeded(t *testing.T)
HandleMultiPayInvoiceEvent(ctx, nip47Request, dbRequestEvent.ID, app, publishResponse)

assert.Equal(t, 2, len(responses))
assert.Equal(t, 2, len(dTags))

// we can't guarantee which request was processed first
// so swap them if they are back to front
if responses[0].Result == nil {
responses[0], responses[1] = responses[1], responses[0]
dTags[0], dTags[1] = dTags[1], dTags[0]
}

assert.Equal(t, "320c2c5a1492ccfd5bc7aa4ad9b657d6aaec3cfcc0d1d98413a29af4ac772ccf", dTags[0].GetFirst([]string{"d"}).Value())
assert.Equal(t, "123preimage", responses[0].Result.(payResponse).Preimage)
Expand Down

0 comments on commit 7b7573e

Please sign in to comment.