package teamsalarysettlement

import (
	"encoding/json"
	"testing"
)

func TestSettlementUserIDsAcceptStringAndNumber(t *testing.T) {
	t.Parallel()
	var req settleRequest
	if err := json.Unmarshal([]byte(`{"user_ids":["323096761415507968",323096761415507969]}`), &req); err != nil {
		t.Fatalf("unmarshal request: %v", err)
	}
	got := settlementUserIDValues(req.UserIDs)
	want := []int64{323096761415507968, 323096761415507969}
	if len(got) != len(want) {
		t.Fatalf("user ids length = %d, want %d", len(got), len(want))
	}
	for index := range want {
		if got[index] != want[index] {
			t.Fatalf("user ids[%d] = %d, want %d", index, got[index], want[index])
		}
	}
}
