github.com/stellar/stellar-etl@v1.0.1-0.20240312145900-4874b6bf2b89/cmd/export_operations_test.go (about)

     1  package cmd
     2  
     3  import (
     4  	"testing"
     5  )
     6  
     7  func TestExportOperations(t *testing.T) {
     8  	tests := []cliTest{
     9  		{
    10  			name:    "operations from one ledger",
    11  			args:    []string{"export_operations", "-s", "30820015", "-e", "30820015", "-o", gotTestDir(t, "one_ledger_ops.txt")},
    12  			golden:  "one_ledger_ops.golden",
    13  			wantErr: nil,
    14  		},
    15  		{
    16  			name:    "operations from 10 ledgers",
    17  			args:    []string{"export_operations", "-s", "30822015", "-e", "30822025", "-o", gotTestDir(t, "10_ledgers_ops.txt")},
    18  			golden:  "10_ledgers_ops.golden",
    19  			wantErr: nil,
    20  		},
    21  		{
    22  			name:    "range too large",
    23  			args:    []string{"export_operations", "-s", "30822015", "-e", "30822025", "-l", "5", "-o", gotTestDir(t, "large_range_ops.txt")},
    24  			golden:  "large_range_ops.golden",
    25  			wantErr: nil,
    26  		},
    27  		{
    28  			name:    "ledger with no operations",
    29  			args:    []string{"export_operations", "-s", "10363513", "-e", "10363513", "-o", gotTestDir(t, "ledger_no_ops.txt")},
    30  			golden:  "ledger_no_ops.golden",
    31  			wantErr: nil,
    32  		},
    33  	}
    34  
    35  	for _, test := range tests {
    36  		runCLITest(t, test, "testdata/operations/")
    37  	}
    38  }