Files
slides/internal/file/file_test.go
Britton Hayes e21cc0c0b3 Allow user customization for slide themes
Closes #1.

This change allows users to add a configuration section to their slides,
which allows them to specify a different theme if they would like to
change the styles of the default theme.

A user can add
```
---
theme: ascii
---
```

To use an ascii theme or use `theme: ./styles.json` to specify their own
custom JSON theme using glamour styles.

Co-authored-by: Britton Hayes <brittonhayes@users.noreply.github.com>
2021-06-12 16:59:00 -04:00

29 lines
606 B
Go

package file_test
import (
"testing"
"github.com/maaslalani/slides/internal/file"
"github.com/stretchr/testify/assert"
)
func TestExists(t *testing.T) {
tests := []struct {
name string
filepath string
want bool
}{
{name: "Find file exists", filepath: "file.go", want: true},
{name: "Return false for missing file", filepath: "afilethatdoesntexist.go", want: false},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
isExist := file.Exists(tt.filepath)
if isExist {
assert.FileExists(t, tt.filepath)
}
assert.Equal(t, tt.want, isExist)
})
}
}