status-go/protocol/communities/request_to_join_test.go
Samuel Hawksby-Robinson 89251e8416
Sync Communities (#2253)
* Added community sync protobuf

* Updated community sync send logic

* Integrated syncCommunity handling

* Added synced_at field and tidied up some other logic

* persistence testing

* Added testing and join functionality

* Fixed issue with empty scan params

* Finshed persistence tests for new db funcs

* Midway debug of description not persisting after sync

* Resolved final issues and tidied up

* Polish

* delint

* Fix error not handled on SetPrivateKey

* fix infinite loop, again

* Added muted option and test fix

* Added Muted to syncing functions, not just in persistence

* Fix bug introduced with Muted property

* Added a couple of notes for future devs

* Added most of the sync RequestToJoin functionality

Tests need to be completed and tests are giving some errors

* Finished tests for getJoinedAndPending

* Added note

* Resolving lint

* Fix of protobuf gen bug

* Fixes to community sync tests

* Fixes to test

* Continued fix of e2e

* Final fix to e2e testing

* Updated migration position

* resolve missing import

* Apparently the linter spellchecks

* Fix bug from  #2276 merge

* Bug fix for leaving quirkiness

* Addressed superfluous MessengerResponse field

* Addressed feedback

* VERSION bump
2021-08-06 16:40:23 +01:00

36 lines
990 B
Go

package communities
import (
"database/sql"
"time"
)
func (s *CommunitySuite) TestRequestToJoin_Empty() {
// Brand new RequestToJoin should be empty
rtj := new(RequestToJoin)
s.True(rtj.Empty(), "The RequestToJoin should be empty")
// Add some values, should not be empty
rtj.State = RequestToJoinStateAccepted
rtj.Clock = uint64(time.Now().Unix())
s.False(rtj.Empty(), "The RequestToJoin should not be empty")
// Overwrite with a new RequestToJoin, should be empty
rtj = new(RequestToJoin)
s.True(rtj.Empty(), "The RequestToJoin should be empty")
// Add some empty values, should be empty
rtj.ChatID = ""
rtj.ENSName = ""
rtj.PublicKey = ""
rtj.Clock = uint64(sql.NullInt64{}.Int64)
rtj = new(RequestToJoin)
s.True(rtj.Empty(), "The RequestToJoin should be empty")
// Add some not empty values, should be not empty
rtj.ChatID = "0x1234abcd"
rtj.ENSName = "@samyoul"
rtj.PublicKey = "0xfedc0987"
s.False(rtj.Empty(), "The RequestToJoin should not be empty")
}