mirror of
https://github.com/aljazceru/nigiri.git
synced 2026-02-06 23:34:31 +01:00
* added mint command * added mint test command * changed error message * changed error message * changed api host address * changed mint tests * changed mint tests 2 * handled unmarshalling errors * added short function to mint tests * fixed unmarshall of mint * return text changes * added error check for status code in mint
67 lines
1.4 KiB
Go
67 lines
1.4 KiB
Go
package cmd
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/vulpemventures/nigiri/cli/constants"
|
|
)
|
|
|
|
func TestMintOneArg(t *testing.T) {
|
|
if testing.Short() {
|
|
t.Skip("skipping testing in short mode")
|
|
}
|
|
testStart(t, liquid)
|
|
|
|
if err := testCommand("mint", "ert1q90dz89u8eudeswzynl3p2jke564ejc2cnfcwuq 1000", liquid); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
testDelete(t)
|
|
}
|
|
|
|
func TestMintTwoArgs(t *testing.T) {
|
|
if testing.Short() {
|
|
t.Skip("skipping testing in short mode")
|
|
}
|
|
testStart(t, liquid)
|
|
|
|
if err := testCommand("mint", "ert1q90dz89u8eudeswzynl3p2jke564ejc2cnfcwuq 2000 Test", liquid); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
testDelete(t)
|
|
}
|
|
|
|
func TestMintThreeArgs(t *testing.T) {
|
|
if testing.Short() {
|
|
t.Skip("skipping testing in short mode")
|
|
}
|
|
testStart(t, liquid)
|
|
|
|
if err := testCommand("mint", "ert1q90dz89u8eudeswzynl3p2jke564ejc2cnfcwuq 3000 TEST TST", liquid); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
testDelete(t)
|
|
|
|
}
|
|
|
|
func TestStartBitcoinAndMintShouldFail(t *testing.T) {
|
|
if testing.Short() {
|
|
t.Skip("skipping testing in short mode")
|
|
}
|
|
testStart(t, bitcoin)
|
|
|
|
expectedError := constants.ErrNigiriLiquidNotEnabled.Error()
|
|
|
|
err := testCommand("mint", "ert1q90dz89u8eudeswzynl3p2jke564ejc2cnfcwuq 1000", liquid)
|
|
if err == nil {
|
|
t.Fatal("Should return error when trying logging liquid services if not running")
|
|
}
|
|
|
|
if err.Error() != expectedError {
|
|
t.Fatalf("Expected error: %s, got: %s", expectedError, err)
|
|
}
|
|
|
|
testDelete(t)
|
|
}
|