-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
44 changed files
with
55 additions
and
4,164 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# Helpers | ||
We have different type of helpers that will provide you simple universal functions that will save your time. | ||
Please review folder `pkg/helpers`. We have helpers like: | ||
`array, auth, call, file, graphql, mysql, price, time, validator geo` and so on | ||
`array, auth, call, file, mysql, price, time, validator geo` and so on | ||
|
||
Only way to be aware with them is to spend some time check the code and inform yourself what can be helpful for you from our helpers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
# Tests | ||
Hitrix provide you test abstract layer that can be used to simulate requests to your graphql api | ||
Hitrix provide you test abstract layer that can be used to simulate requests to your api | ||
|
||
In your code you can create similar function that makes new instance of your app | ||
|
||
```go | ||
func createContextMyApp(t *testing.T, projectName string, resolvers graphql.ExecutableSchema) *test.Ctx { | ||
func createContextMyApp(t *testing.T, projectName string) *test.Ctx { | ||
defaultServices := []*service.Definition{ | ||
registry.ServiceProviderConfigDirectory("../example/config"), | ||
registry.ServiceProviderOrmRegistry(entity.Init), | ||
|
@@ -22,35 +22,6 @@ func createContextMyApp(t *testing.T, projectName string, resolvers graphql.Exec | |
|
||
``` | ||
|
||
After that you can call queries or mutations | ||
|
||
```go | ||
func TestProcessApplePurchaseWithEmail(t *testing.T) { | ||
type queryRegisterTransactions struct { | ||
RegisterTransactionsResponse *model.RegisterTransactionsResponse `graphql:"RegisterTransactions(applePurchaseRequest: $applePurchaseRequest)"` | ||
} | ||
|
||
variables := map[string]interface{}{ | ||
"applePurchaseRequest": model.ApplePurchaseRequest{ | ||
ForceEmail: false, | ||
}, | ||
} | ||
|
||
fakeMail := &mailMock.Sender{} | ||
fakeMail.On("SendTemplate", "[email protected]").Return(nil) | ||
|
||
got := &queryRegisterTransactions{} | ||
projectName, resolver := tests.GetWebAPIResolver() | ||
ctx := tests.CreateContextWebAPI(t, projectName, resolver, &tests.IoCMocks{MailService: fakeMail}) | ||
|
||
err := ctx.HandleMutation(got, variables) | ||
assert.Nil(t, err) | ||
|
||
//... | ||
fakeMail.AssertExpectations(t) | ||
} | ||
``` | ||
|
||
Hitrix supports `parallel` tests | ||
In case you want to execute parallel tests you need to set | ||
`PARALLEL_TESTS=true` env var in your IDE config and be sure you don't have set `-p 1` in `Go tool arguments` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.