github.com/seeker-insurance/kit@v0.0.13/opentable/opentable_test.go (about) 1 package opentable 2 3 import ( 4 "testing" 5 ) 6 7 func TestBadRequestError_Error(t *testing.T) { 8 tests := []struct { 9 name string 10 err BadRequestError 11 want string 12 }{ 13 // TODO: Add test cases. 14 } 15 for _, tt := range tests { 16 t.Run(tt.name, func(t *testing.T) { 17 if got := tt.err.Error(); got != tt.want { 18 t.Errorf("BadRequestError.Error() = %v, want %v", got, tt.want) 19 } 20 }) 21 } 22 } 23 24 func Test_accessToken(t *testing.T) { 25 tests := []struct { 26 name string 27 want string 28 want1 bool 29 }{ 30 // TODO: Add test cases. 31 } 32 for _, tt := range tests { 33 t.Run(tt.name, func(t *testing.T) { 34 got, got1 := accessToken() 35 if got != tt.want { 36 t.Errorf("accessToken() got = %v, want %v", got, tt.want) 37 } 38 if got1 != tt.want1 { 39 t.Errorf("accessToken() got1 = %v, want %v", got1, tt.want1) 40 } 41 }) 42 } 43 } 44 45 func Test_priceOK(t *testing.T) { 46 type args struct { 47 price int 48 } 49 tests := []struct { 50 name string 51 args args 52 want bool 53 }{ 54 // TODO: Add test cases. 55 } 56 for _, tt := range tests { 57 t.Run(tt.name, func(t *testing.T) { 58 if got := priceOK(tt.args.price); got != tt.want { 59 t.Errorf("priceOK() = %v, want %v", got, tt.want) 60 } 61 }) 62 } 63 } 64 65 func Test_perPageOK(t *testing.T) { 66 type args struct { 67 perPage int 68 } 69 tests := []struct { 70 name string 71 args args 72 want bool 73 }{ 74 // TODO: Add test cases. 75 } 76 for _, tt := range tests { 77 t.Run(tt.name, func(t *testing.T) { 78 if got := perPageOK(tt.args.perPage); got != tt.want { 79 t.Errorf("perPageOK() = %v, want %v", got, tt.want) 80 } 81 }) 82 } 83 } 84 85 func Test_pageOK(t *testing.T) { 86 type args struct { 87 page int 88 } 89 tests := []struct { 90 name string 91 args args 92 want bool 93 }{ 94 // TODO: Add test cases. 95 } 96 for _, tt := range tests { 97 t.Run(tt.name, func(t *testing.T) { 98 if got := pageOK(tt.args.page); got != tt.want { 99 t.Errorf("pageOK() = %v, want %v", got, tt.want) 100 } 101 }) 102 } 103 } 104 105 func Test_request_validate(t *testing.T) { 106 type fields struct { 107 Price int 108 Name string 109 Street string 110 State string 111 City string 112 Zip string 113 Country string 114 Page int 115 PerPage int 116 } 117 tests := []struct { 118 name string 119 fields fields 120 wantErr bool 121 }{ 122 // TODO: Add test cases. 123 } 124 for _, tt := range tests { 125 t.Run(tt.name, func(t *testing.T) { 126 r := &request{ 127 Price: tt.fields.Price, 128 Name: tt.fields.Name, 129 Street: tt.fields.Street, 130 State: tt.fields.State, 131 City: tt.fields.City, 132 Zip: tt.fields.Zip, 133 Country: tt.fields.Country, 134 Page: tt.fields.Page, 135 PerPage: tt.fields.PerPage, 136 } 137 if err := r.validate(); (err != nil) != tt.wantErr { 138 t.Errorf("request.validate() error = %v, wantErr %v", err, tt.wantErr) 139 } 140 }) 141 } 142 } 143 144 type byKey []param 145 146 func (bk byKey) Len() int { return len(bk) } 147 func (bk byKey) Less(i, j int) bool { return bk[i].key < bk[j].key } 148 func (bk byKey) Swap(i, j int) { bk[i], bk[j] = bk[j], bk[i] } 149 150 func Test_request_Get(t *testing.T) { 151 152 }