Merge branch 'develop'
# Conflicts: # frontend/src/pages/places.vue
This commit is contained in:
commit
098d8e9493
5 changed files with 78 additions and 2 deletions
|
@ -130,11 +130,11 @@
|
|||
const changed = Math.abs(this.query.lat - pos.lat) > 0.001 ||
|
||||
Math.abs(this.query.long - pos.lng) > 0.001;
|
||||
|
||||
if(!changed) return;
|
||||
|
||||
this.query.lat = pos.lat.toString();
|
||||
this.query.long = pos.lng.toString();
|
||||
|
||||
if(!changed) return;
|
||||
|
||||
this.search();
|
||||
},
|
||||
startPos() {
|
||||
|
|
18
internal/util/keywords_test.go
Normal file
18
internal/util/keywords_test.go
Normal file
|
@ -0,0 +1,18 @@
|
|||
package util
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestKeywords(t *testing.T) {
|
||||
t.Run("cat", func(t *testing.T) {
|
||||
keywords := Keywords("cat")
|
||||
assert.Equal(t, []string{"cat"}, keywords)
|
||||
})
|
||||
t.Run("was", func(t *testing.T) {
|
||||
keywords := Keywords("was")
|
||||
assert.Equal(t, []string(nil), keywords)
|
||||
})
|
||||
}
|
20
internal/util/mime_test.go
Normal file
20
internal/util/mime_test.go
Normal file
|
@ -0,0 +1,20 @@
|
|||
package util
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestMimeType(t *testing.T) {
|
||||
t.Run("jpg", func(t *testing.T) {
|
||||
filename := ExpandedFilename("./testdata/test.jpg")
|
||||
mimeType := MimeType(filename)
|
||||
assert.Equal(t, "image/jpeg", mimeType)
|
||||
})
|
||||
t.Run("not existing filename", func(t *testing.T) {
|
||||
filename := ExpandedFilename("./testdata/xxx.jpg")
|
||||
mimeType := MimeType(filename)
|
||||
assert.Equal(t, "", mimeType)
|
||||
})
|
||||
}
|
|
@ -6,6 +6,15 @@ import (
|
|||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestContainsNumber(t *testing.T) {
|
||||
t.Run("True", func(t *testing.T) {
|
||||
assert.Equal(t, true, ContainsNumber("f3abcde"))
|
||||
})
|
||||
t.Run("False", func(t *testing.T) {
|
||||
assert.Equal(t, false, ContainsNumber("abcd"))
|
||||
})
|
||||
}
|
||||
|
||||
func TestIsSeparator(t *testing.T) {
|
||||
t.Run("rune A", func(t *testing.T) {
|
||||
assert.Equal(t, false, isSeparator('A'))
|
||||
|
|
29
internal/util/token_test.go
Normal file
29
internal/util/token_test.go
Normal file
|
@ -0,0 +1,29 @@
|
|||
package util
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestRandomToken(t *testing.T) {
|
||||
t.Run("size 4", func(t *testing.T) {
|
||||
token := RandomToken(4)
|
||||
assert.NotEmpty(t, token)
|
||||
})
|
||||
t.Run("size 8", func(t *testing.T) {
|
||||
token := RandomToken(9)
|
||||
assert.NotEmpty(t, token)
|
||||
})
|
||||
}
|
||||
|
||||
func TestUUID(t *testing.T) {
|
||||
t.Run("size 4", func(t *testing.T) {
|
||||
uuid := UUID()
|
||||
assert.Equal(t, 36, len(uuid))
|
||||
})
|
||||
t.Run("size 8", func(t *testing.T) {
|
||||
uuid := UUID()
|
||||
assert.Equal(t, 36, len(uuid))
|
||||
})
|
||||
}
|
Loading…
Reference in a new issue