aboutsummaryrefslogtreecommitdiffstats
path: root/todolist/file_store_test.go
blob: 3e10491de981ff6c4ed03479f70998a564701128 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package todolist

import (
	"testing"

	"github.com/stretchr/testify/assert"
)

func TestFileStore(t *testing.T) {
	assert := assert.New(t)
	store := &FileStore{FileLocation: "todos.json"}
	store.Load()
	assert.Equal(store.Data[0].Subject, "this is the first subject", "")
}

func TestSave(t *testing.T) {
	store := &FileStore{FileLocation: "todos.json"}
	store.Load()
	store.Save()
}

func TestNextId(t *testing.T) {
	assert := assert.New(t)
	store := &FileStore{FileLocation: "todos.json"}
	store.Load()
	assert.Equal(3, store.NextId())
}