aboutsummaryrefslogtreecommitdiffstats
path: root/todo_test.go
diff options
context:
space:
mode:
authorGrant Ammons <gammons@gmail.com>2016-04-23 16:59:52 -0400
committerGrant Ammons <gammons@gmail.com>2016-04-23 16:59:52 -0400
commit8138ffaf380fb646b6877dd20f874735eddd2d6d (patch)
treeda3077b68ff432d4ffe2aeae234ecb70843a3165 /todo_test.go
Initial commit
Diffstat (limited to 'todo_test.go')
-rw-r--r--todo_test.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/todo_test.go b/todo_test.go
new file mode 100644
index 0000000..aab2a74
--- /dev/null
+++ b/todo_test.go
@@ -0,0 +1,23 @@
+package todolist
+
+import "testing"
+
+func TestNewTodo(t *testing.T) {
+ todo := NewTodo()
+
+ if todo.Completed || todo.Archived {
+ t.Error("Completed should be false for new todos")
+ }
+}
+
+func TestValidity(t *testing.T) {
+ todo := &Todo{Subject: "test"}
+ if !todo.Valid() {
+ t.Error("Expected valid todo to be valid")
+ }
+
+ invalidTodo := &Todo{Subject: ""}
+ if invalidTodo.Valid() {
+ t.Error("Invalid todo is being reported as valid")
+ }
+}