-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Luis Brienze <lfbrienze@gmail.com>
- Loading branch information
Showing
6 changed files
with
80 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
MINIMUM_CRYPTO_SELL_OPERATION=0.001 | ||
MINIMUM_CRYPTO_BUY_OPERATION=0.001 |
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 was deleted.
Oops, something went wrong.
31 changes: 31 additions & 0 deletions
31
test/internal/operation-hub/application/config/load_env_test.go
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package config | ||
|
||
import ( | ||
"github.com/brienze1/crypto-robot-operation-hub/internal/operation-hub/application/config" | ||
"github.com/google/uuid" | ||
"github.com/stretchr/testify/assert" | ||
"os" | ||
"testing" | ||
) | ||
|
||
func TestLoadEnvSuccess(t *testing.T) { | ||
err := os.Setenv("OPERATION_HUB_ENV", "test") | ||
assert.Nil(t, err) | ||
|
||
defer func() { | ||
r := recover() | ||
|
||
assert.Nil(t, r) | ||
}() | ||
|
||
config.LoadEnv() | ||
} | ||
|
||
func TestLoadEnvFailure(t *testing.T) { | ||
err := os.Setenv("OPERATION_HUB_ENV", uuid.NewString()) | ||
assert.Nil(t, err) | ||
|
||
panicFunction := func() { config.LoadEnv() } | ||
|
||
assert.Panicsf(t, panicFunction, "Should panic") | ||
} |
42 changes: 42 additions & 0 deletions
42
test/internal/operation-hub/application/properties/properties_test.go
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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package properties | ||
|
||
import ( | ||
"github.com/brienze1/crypto-robot-operation-hub/internal/operation-hub/application/properties" | ||
"github.com/google/uuid" | ||
"github.com/stretchr/testify/assert" | ||
"os" | ||
"testing" | ||
) | ||
|
||
func setup() { | ||
_ = os.Setenv("MINIMUM_CRYPTO_SELL_OPERATION", "0.1") | ||
_ = os.Setenv("MINIMUM_CRYPTO_BUY_OPERATION", "0.1") | ||
} | ||
|
||
func TestPropertiesMinimumCryptoSellOperationFailure(t *testing.T) { | ||
setup() | ||
|
||
_ = os.Setenv("MINIMUM_CRYPTO_SELL_OPERATION", uuid.NewString()) | ||
|
||
panicFunction := func() { properties.Properties() } | ||
|
||
assert.Panicsf(t, panicFunction, "Should panic") | ||
} | ||
|
||
func TestPropertiesMinimumCryptoBuyOperationFailure(t *testing.T) { | ||
setup() | ||
|
||
_ = os.Setenv("MINIMUM_CRYPTO_BUY_OPERATION", uuid.NewString()) | ||
|
||
panicFunction := func() { properties.Properties() } | ||
|
||
assert.Panicsf(t, panicFunction, "Should panic") | ||
} | ||
|
||
func TestPropertiesSuccess(t *testing.T) { | ||
setup() | ||
|
||
panicFunction := func() { properties.Properties() } | ||
|
||
assert.NotPanicsf(t, panicFunction, "Should not panic") | ||
} |