Permalink
Browse files

Started work on a CRUD interface for the core

  • Loading branch information...
kiriappeee committed May 7, 2018
1 parent 8955153 commit 8ea659e19e37c82e98e4a871322831a7e580ada2
Showing with 33 additions and 0 deletions.
  1. +9 −0 statuscrud.go
  2. +24 −0 statuscrud_test.go
@@ -0,0 +1,9 @@
package ssucore

type StatusCRUDInterface interface {
List() []Status
}

func GetStatuses(sci StatusCRUDInterface) []Status {
return sci.List()
}
@@ -0,0 +1,24 @@
package ssucore

import (
"testing"
)

type StatusCrudMockImplementer string

func (s StatusCrudMockImplementer) List() []Status {
return []Status{
Status{"test", "me", "now"},
Status{"test", "me", "now"},
Status{"test", "me", "now"},
Status{"test", "me", "now"},
}
}
func TestStatusCRUDWillReturnStatuses(t *testing.T) {
var sci StatusCRUDInterface
sci = StatusCrudMockImplementer("testing")
statusList := GetStatuses(sci)
if len(statusList) != 4 {
t.Fatalf("Length of returned array was not %d. Expected 4", len(statusList))
}
}

0 comments on commit 8ea659e

Please sign in to comment.