mirror of
https://github.com/Forceu/Gokapi.git
synced 2026-05-12 01:19:35 -05:00
9c9ea6dbb7
* 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
44 lines
803 B
Go
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
|
|
}
|