github.com/polygon-io/client-go@v1.16.4/rest/models/dividends_test.go (about)

     1  package models_test
     2  
     3  import (
     4  	"testing"
     5  	"time"
     6  
     7  	"github.com/polygon-io/client-go/rest/models"
     8  )
     9  
    10  func TestListDividendsParams(t *testing.T) {
    11  	ticker := "A"
    12  	date := models.Date(time.Date(2023, 3, 23, 0, 0, 0, 0, time.Local))
    13  	cash := 1.25
    14  	frequency := models.Annually
    15  	dividendType := models.DividendCD
    16  	order := models.Asc
    17  	limit := 100
    18  	sort := models.TickerSymbol
    19  	expect := models.ListDividendsParams{
    20  		TickerEQ:           &ticker,
    21  		TickerLT:           &ticker,
    22  		TickerLTE:          &ticker,
    23  		TickerGT:           &ticker,
    24  		TickerGTE:          &ticker,
    25  		ExDividendDateEQ:   &date,
    26  		ExDividendDateLT:   &date,
    27  		ExDividendDateLTE:  &date,
    28  		ExDividendDateGT:   &date,
    29  		ExDividendDateGTE:  &date,
    30  		DeclarationDateEQ:  &date,
    31  		DeclarationDateLT:  &date,
    32  		DeclarationDateLTE: &date,
    33  		DeclarationDateGT:  &date,
    34  		DeclarationDateGTE: &date,
    35  		CashAmountEQ:       &cash,
    36  		CashAmountLT:       &cash,
    37  		CashAmountLTE:      &cash,
    38  		CashAmountGT:       &cash,
    39  		CashAmountGTE:      &cash,
    40  		Frequency:          &frequency,
    41  		DividendType:       &dividendType,
    42  		Order:              &order,
    43  		Limit:              &limit,
    44  		Sort:               &sort,
    45  	}
    46  	actual := models.ListDividendsParams{}.
    47  		WithTicker(models.EQ, ticker).
    48  		WithTicker(models.LT, ticker).
    49  		WithTicker(models.LTE, ticker).
    50  		WithTicker(models.GT, ticker).
    51  		WithTicker(models.GTE, ticker).
    52  		WithExDividendDate(models.EQ, date).
    53  		WithExDividendDate(models.LT, date).
    54  		WithExDividendDate(models.LTE, date).
    55  		WithExDividendDate(models.GT, date).
    56  		WithExDividendDate(models.GTE, date).
    57  		WithDeclarationDate(models.EQ, date).
    58  		WithDeclarationDate(models.LT, date).
    59  		WithDeclarationDate(models.LTE, date).
    60  		WithDeclarationDate(models.GT, date).
    61  		WithDeclarationDate(models.GTE, date).
    62  		WithCashAmount(models.EQ, cash).
    63  		WithCashAmount(models.LT, cash).
    64  		WithCashAmount(models.LTE, cash).
    65  		WithCashAmount(models.GT, cash).
    66  		WithCashAmount(models.GTE, cash).
    67  		WithFrequency(models.Annually).
    68  		WithDividendType(models.DividendCD).
    69  		WithOrder(order).
    70  		WithLimit(limit).
    71  		WithSort(sort)
    72  
    73  	checkParams(t, expect, *actual)
    74  }