This repository has been archived by the owner on Jun 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: change env name at exchange block
- Loading branch information
1 parent
3236356
commit 25347d8
Showing
2 changed files
with
56 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package config | ||
|
||
import ( | ||
"context" | ||
"reflect" | ||
"testing" | ||
) | ||
|
||
func TestNewConfig(t *testing.T) { | ||
type args struct { | ||
ctx context.Context | ||
} | ||
|
||
tests := []struct { | ||
name string | ||
args args | ||
want *Config | ||
wantErr bool | ||
}{ | ||
{name: testing.CoverMode(), args: args{ctx: context.Background()}, want: &Config{ | ||
Exchange: ExchangeConfig{ | ||
Url: "wss://ws-feed.exchange.coinbase.com", | ||
Origin: "https://coinbase.com", | ||
Protocol: "", | ||
Symbols: []string{"ETH-BTC", "BTC-USD", "BTC-EUR"}, | ||
Channels: []string{"ticker"}, | ||
}, | ||
Database: DatabaseConfig{ | ||
Host: "localhost:3306", | ||
User: "test_mysql", | ||
Password: "a2s_kjlasjd", | ||
Base: "test", | ||
}, | ||
Logger: LoggerConfig{ | ||
DisableCaller: false, | ||
DisableStacktrace: true, | ||
Level: "debug", | ||
}, | ||
}, wantErr: false}, | ||
} | ||
|
||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
got, err := NewConfig(tt.args.ctx) | ||
if (err != nil) != tt.wantErr { | ||
t.Errorf("NewConfig() error = %v, wantErr %v", err, tt.wantErr) | ||
return | ||
} | ||
if !reflect.DeepEqual(got, tt.want) { | ||
t.Errorf("NewConfig() got = %v, want %v", got, tt.want) | ||
} | ||
}) | ||
} | ||
} |