File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -212,3 +212,26 @@ func TestGetEquipmentInstance_Grenade_Thrown(t *testing.T) {
212212
213213 assert .Equal (t , & he , wep )
214214}
215+
216+ func TestGetCommunityId (t * testing.T ) {
217+ xuid , err := getCommunityID ("abcdefgh1:3" )
218+ assert .Nil (t , err )
219+ expected := int64 (76561197960265728 + 6 + 1 )
220+ assert .Equal (t , expected , xuid )
221+ }
222+
223+ func TestGetCommunityId_BOT (t * testing.T ) {
224+ xuid , err := getCommunityID ("BOT" )
225+ assert .Zero (t , xuid )
226+ assert .Nil (t , err )
227+ }
228+
229+ func TestGetCommunityId_Errors (t * testing.T ) {
230+ _ , err := getCommunityID ("12345678a90123" )
231+ assert .NotNil (t , err )
232+ assert .Equal (t , "strconv.ParseInt: parsing \" a\" : invalid syntax" , err .Error ())
233+
234+ _ , err = getCommunityID ("1234567890abc" )
235+ assert .NotNil (t , err )
236+ assert .Equal (t , "strconv.ParseInt: parsing \" abc\" : invalid syntax" , err .Error ())
237+ }
You can’t perform that action at this time.
0 commit comments