github.com/mdaxf/iac@v0.0.0-20240519030858-58a061660378/controllers/collectionop/collectionop_test.go (about) 1 package collectionop 2 3 import ( 4 "reflect" 5 "testing" 6 7 "github.com/gin-gonic/gin" 8 "go.mongodb.org/mongo-driver/bson" 9 ) 10 11 func TestCollectionController_GetListofCollectionData(t *testing.T) { 12 type args struct { 13 ctx *gin.Context 14 } 15 tests := []struct { 16 name string 17 c *CollectionController 18 args args 19 }{ 20 // TODO: Add test cases. 21 } 22 for _, tt := range tests { 23 t.Run(tt.name, func(t *testing.T) { 24 tt.c.GetListofCollectionData(tt.args.ctx) 25 }) 26 } 27 } 28 29 func TestCollectionController_GetDetailCollectionData(t *testing.T) { 30 type args struct { 31 ctx *gin.Context 32 } 33 tests := []struct { 34 name string 35 c *CollectionController 36 args args 37 }{ 38 // TODO: Add test cases. 39 } 40 for _, tt := range tests { 41 t.Run(tt.name, func(t *testing.T) { 42 tt.c.GetDetailCollectionData(tt.args.ctx) 43 }) 44 } 45 } 46 47 func TestCollectionController_GetDetailCollectionDatabyID(t *testing.T) { 48 type args struct { 49 ctx *gin.Context 50 } 51 tests := []struct { 52 name string 53 c *CollectionController 54 args args 55 }{ 56 // TODO: Add test cases. 57 } 58 for _, tt := range tests { 59 t.Run(tt.name, func(t *testing.T) { 60 tt.c.GetDetailCollectionDatabyID(tt.args.ctx) 61 }) 62 } 63 } 64 65 func TestCollectionController_GetDetailCollectionDatabyName(t *testing.T) { 66 type args struct { 67 ctx *gin.Context 68 } 69 tests := []struct { 70 name string 71 c *CollectionController 72 args args 73 }{ 74 // TODO: Add test cases. 75 } 76 for _, tt := range tests { 77 t.Run(tt.name, func(t *testing.T) { 78 tt.c.GetDetailCollectionDatabyName(tt.args.ctx) 79 }) 80 } 81 } 82 83 func TestCollectionController_UpdateCollectionData(t *testing.T) { 84 type args struct { 85 ctx *gin.Context 86 } 87 tests := []struct { 88 name string 89 c *CollectionController 90 args args 91 }{ 92 // TODO: Add test cases. 93 } 94 for _, tt := range tests { 95 t.Run(tt.name, func(t *testing.T) { 96 tt.c.UpdateCollectionData(tt.args.ctx) 97 }) 98 } 99 } 100 101 func TestCollectionController_DeleteCollectionDatabyID(t *testing.T) { 102 type args struct { 103 ctx *gin.Context 104 } 105 tests := []struct { 106 name string 107 c *CollectionController 108 args args 109 }{ 110 // TODO: Add test cases. 111 } 112 for _, tt := range tests { 113 t.Run(tt.name, func(t *testing.T) { 114 tt.c.DeleteCollectionDatabyID(tt.args.ctx) 115 }) 116 } 117 } 118 119 func TestCollectionController_buildProjectionFromJSON(t *testing.T) { 120 type args struct { 121 jsonData []byte 122 converttype string 123 } 124 tests := []struct { 125 name string 126 c *CollectionController 127 args args 128 want bson.M 129 wantErr bool 130 }{ 131 // TODO: Add test cases. 132 } 133 for _, tt := range tests { 134 t.Run(tt.name, func(t *testing.T) { 135 got, err := tt.c.buildProjectionFromJSON(tt.args.jsonData, tt.args.converttype) 136 if (err != nil) != tt.wantErr { 137 t.Errorf("CollectionController.buildProjectionFromJSON() error = %v, wantErr %v", err, tt.wantErr) 138 return 139 } 140 if !reflect.DeepEqual(got, tt.want) { 141 t.Errorf("CollectionController.buildProjectionFromJSON() = %v, want %v", got, tt.want) 142 } 143 }) 144 } 145 } 146 147 func TestCollectionController_buildProjection(t *testing.T) { 148 type args struct { 149 jsonMap map[string]interface{} 150 prefix string 151 projection bson.M 152 converttype string 153 } 154 tests := []struct { 155 name string 156 c *CollectionController 157 args args 158 }{ 159 // TODO: Add test cases. 160 } 161 for _, tt := range tests { 162 t.Run(tt.name, func(t *testing.T) { 163 tt.c.buildProjection(tt.args.jsonMap, tt.args.prefix, tt.args.projection, tt.args.converttype) 164 }) 165 } 166 } 167 168 func TestCollectionController_CollectionObjectRevision(t *testing.T) { 169 type args struct { 170 ctx *gin.Context 171 } 172 tests := []struct { 173 name string 174 c *CollectionController 175 args args 176 }{ 177 // TODO: Add test cases. 178 } 179 for _, tt := range tests { 180 t.Run(tt.name, func(t *testing.T) { 181 tt.c.CollectionObjectRevision(tt.args.ctx) 182 }) 183 } 184 }