forked from cwtch.im/cwtch
31 lines
711 B
Go
31 lines
711 B
Go
|
package server
|
||
|
|
||
|
import (
|
||
|
"git.mascherari.press/cwtch/protocol"
|
||
|
"git.mascherari.press/cwtch/storage"
|
||
|
"github.com/s-rah/go-ricochet/application"
|
||
|
"os"
|
||
|
"testing"
|
||
|
)
|
||
|
|
||
|
func TestServerInstance(t *testing.T) {
|
||
|
si := new(ServerInstance)
|
||
|
ai := new(application.ApplicationInstance)
|
||
|
ra := new(application.RicochetApplication)
|
||
|
msi := new(storage.MessageStore)
|
||
|
os.Remove("ms.test")
|
||
|
msi.Init("ms.test")
|
||
|
gm := protocol.GroupMessage{
|
||
|
Ciphertext: []byte("Hello this is a fairly average length message that we are writing here."),
|
||
|
Spamguard: []byte{},
|
||
|
}
|
||
|
|
||
|
si.Init(ai, ra, msi)
|
||
|
msi.AddMessage(gm)
|
||
|
res := si.HandleFetchRequest()
|
||
|
|
||
|
if len(res) != 1 {
|
||
|
t.Errorf("Expected Group Messages Instead got %v", res)
|
||
|
}
|
||
|
}
|