-
Notifications
You must be signed in to change notification settings - Fork 3
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
1 parent
f4e3a4f
commit 908d4b1
Showing
23 changed files
with
829 additions
and
235 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package client | ||
|
||
import ( | ||
"testing" | ||
) | ||
|
||
func TestIndexQuoteRequest_Packed(t *testing.T) { | ||
iqPacked, err := IndexQuotes().Symbol("VIX").FiftyTwoWeek(true).Packed() | ||
if err != nil { | ||
t.Errorf("Failed to get index quotes: %v", err) | ||
return | ||
} | ||
|
||
iq, err := iqPacked.Unpack() | ||
if err != nil { | ||
t.Errorf("Failed to unpack index quotes: %v", err) | ||
return | ||
} | ||
|
||
if len(iq) == 0 { | ||
t.Errorf("Unpacked index quotes slice is empty") | ||
return | ||
} | ||
|
||
firstQuote := iq[0] | ||
if firstQuote.Symbol != "VIX" { | ||
t.Errorf("Expected symbol VIX, got %s", firstQuote.Symbol) | ||
} | ||
|
||
if firstQuote.Last < 0 || firstQuote.Last > 100 { | ||
t.Errorf("Expected last value to be between 0 and 100, got %f", firstQuote.Last) | ||
} | ||
} | ||
|
||
func TestIndexQuoteRequest_Get(t *testing.T) { | ||
iq, err := IndexQuotes().Symbol("VIX").FiftyTwoWeek(false).Get() | ||
if err != nil { | ||
t.Errorf("Failed to get index quotes: %v", err) | ||
return | ||
} | ||
|
||
if len(iq) == 0 { | ||
t.Errorf("Index quotes slice is empty") | ||
return | ||
} | ||
|
||
for _, quote := range iq { | ||
if quote.Symbol != "VIX" { | ||
t.Errorf("Expected symbol VIX, got %s", quote.Symbol) | ||
} | ||
if quote.Last < 0 || quote.Last > 100 { | ||
t.Errorf("Expected last value to be between 0 and 100, got %f", quote.Last) | ||
} | ||
} | ||
} |
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
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.