webp_server_go/update_test.go
Benny 428192275b
choose webp or png feature (#70)
* support webp_bigger header, add test cases

* fix test case
2021-02-12 16:13:13 +08:00

37 lines
652 B
Go

// webp_server_go - update_test
// 2020-11-10 09:36
// Benny <benny.think@gmail.com>
package main
import (
"github.com/stretchr/testify/assert"
"os"
"testing"
)
func TestNormalAutoUpdate(t *testing.T) {
version = "0.0.1"
dir := "./update"
autoUpdate()
assert.NotEqual(t, 0, fileCount(dir))
_ = os.RemoveAll(dir)
}
func Test404AutoUpdate(t *testing.T) {
version = "0.0.1"
dir := "./update"
releaseUrl = releaseUrl + "a"
autoUpdate()
assert.Equal(t, 0, fileCount(dir))
_ = os.RemoveAll(dir)
}
func TestNoNeedAutoUpdate(t *testing.T) {
version = "99.99"
dir := "./update"
autoUpdate()
info, _ := os.Stat(dir)
assert.Nil(t, info)
}