Files
Gokapi/cmd/databasereader/Main_test.go
T
Marc Ole Bulling 9c9ea6dbb7 Add end-to-end encryption (#71)
* Added WASM module for e2e

* Added cmd util to read database

* Changed to go 1.19

* Fixed crash with random string generator

* Fixed typos and tests

* Host service worker on github
2022-08-11 13:37:55 +02:00

44 lines
803 B
Go

package main
import (
"github.com/forceu/gokapi/internal/test"
"github.com/forceu/gokapi/internal/test/testconfiguration"
"os"
"testing"
)
func TestMain(m *testing.M) {
testconfiguration.Create(false)
exitVal := m.Run()
testconfiguration.Delete()
os.Exit(exitVal)
}
func TestRun(t *testing.T) {
originalArgs := os.Args
hasExited := false
osExit = func(code int) {
hasExited = true
}
os.Args = []string{os.Args[0]}
main()
test.IsEqualBool(t, hasExited, true)
hasExited = false
os.Args = append(os.Args, "")
main()
test.IsEqualBool(t, hasExited, true)
hasExited = false
os.Args[1] = "invalidFolder"
main()
test.IsEqualBool(t, hasExited, true)
hasExited = false
os.Args[1] = "./test/filestorage.db"
main()
test.IsEqualBool(t, hasExited, false)
os.Args = originalArgs
}