File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ package component
2+
3+ import (
4+ "github.com/stretchr/testify/assert"
5+ "testing"
6+ )
7+
8+ func TestOptions (t * testing.T ) {
9+ tests := []struct {
10+ name string
11+ opts []GetSetVariableOption
12+ expected componentVariableOptions
13+ }{
14+ {
15+ name : "default options" ,
16+ expected : componentVariableOptions {
17+ attributeType : "" ,
18+ },
19+ opts : []GetSetVariableOption {},
20+ },
21+ {
22+ name : "with attribute type" ,
23+ expected : componentVariableOptions {
24+ attributeType : "abc" ,
25+ },
26+ opts : []GetSetVariableOption {
27+ WithAttributeType ("abc" ),
28+ },
29+ },
30+ }
31+
32+ for _ , tt := range tests {
33+ t .Run (tt .name , func (t * testing.T ) {
34+ opts := componentVariableOptions {}
35+ for _ , opt := range tt .opts {
36+ opt (& opts )
37+ }
38+
39+ assert .Equal (t , tt .expected , opts )
40+ })
41+ }
42+ }
You can’t perform that action at this time.
0 commit comments