@@ -92,50 +92,48 @@ func Test_runRemoveCmd(t *testing.T) {
9292 tests := []struct {
9393 name string
9494 cli string
95- profiles map [ string ] bool
95+ profiles []config. Profile
9696 wantsErr string
9797 wantOut string
9898 }{
9999 {
100100 name : "existing profile (default)" ,
101101 cli : "default --confirm" ,
102- profiles : map [ string ] bool { "default" : true , "foo" : false },
102+ profiles : []config. Profile {{ Name : "default" , Default : true }, { Name : "foo" , Default : false } },
103103 wantOut : "✓ 'default' removed successfully. Set a new default profile with 'algolia profile setdefault'.\n " ,
104104 },
105105 {
106106 name : "existing profile (non-default)" ,
107107 cli : "foo --confirm" ,
108- profiles : map [ string ] bool { "default" : true , "foo" : false },
108+ profiles : []config. Profile {{ Name : "default" , Default : true }, { Name : "foo" , Default : false } },
109109 wantOut : "✓ 'foo' removed successfully.\n " ,
110110 },
111111 {
112112 name : "non-existant profile" ,
113113 cli : "bar --confirm" ,
114- profiles : map [ string ] bool { "default" : true , "foo" : false },
114+ profiles : []config. Profile {{ Name : "default" , Default : true }, { Name : "foo" , Default : false } },
115115 wantsErr : "the specified profile does not exist: 'bar'" ,
116116 },
117117 {
118118 name : "only one profile (default)" ,
119119 cli : "default --confirm" ,
120- profiles : map [ string ] bool { "default" : true },
120+ profiles : []config. Profile {{ Name : "default" , Default : true } },
121121 wantOut : "✓ 'default' removed successfully. Add a profile with 'algolia profile add'.\n " ,
122122 },
123123 {
124124 name : "only one profile (non-default)" ,
125125 cli : "foo --confirm" ,
126- profiles : map [ string ] bool { "foo" : false },
126+ profiles : []config. Profile {{ Name : "foo" , Default : false } },
127127 wantOut : "✓ 'foo' removed successfully. Add a profile with 'algolia profile add'.\n " ,
128128 },
129129 }
130130
131131 for _ , tt := range tests {
132132 t .Run (tt .name , func (t * testing.T ) {
133133 var p []* config.Profile
134- for k , v := range tt .profiles {
135- p = append (p , & config.Profile {
136- Name : k ,
137- Default : v ,
138- })
134+ for _ , v := range tt .profiles {
135+ v := v
136+ p = append (p , & v )
139137 }
140138 cfg := test .NewConfigStubWithProfiles (p )
141139 f , out := test .NewFactory (true , nil , cfg , "" )
0 commit comments