-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain_test.go
42 lines (31 loc) · 956 Bytes
/
main_test.go
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package main_test
import (
"io/ioutil"
"os"
"path/filepath"
"github.com/cbguder/unc/helpers"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/gexec"
)
var _ = Describe("Main", func() {
BeforeEach(func() {
os.Setenv("TZ", "America/Los_Angeles")
})
AfterEach(func() {
os.Unsetenv("TZ")
})
It("produces the expected output", func() {
vesperNotesPath := helpers.GetFixturePath("vesper")
outputDir, err := ioutil.TempDir("", "evernote")
Expect(err).NotTo(HaveOccurred())
defer os.RemoveAll(outputDir)
outputFile := filepath.Join(outputDir, "notes.enex")
session := Run("-f", "vesper", "-t", "evernote", "-i", vesperNotesPath, "-o", outputFile)
Eventually(session).Should(Exit(0))
actualEnex, err := ioutil.ReadFile(outputFile)
Expect(err).NotTo(HaveOccurred())
expectedEnex := helpers.ReadFixtureString("evernote.enex")
Expect(string(actualEnex)).To(Equal(expectedEnex))
})
})