Merge branch 'master' into mark-as-unread

Этот коммит содержится в:
Harrison Healey
2019-10-17 09:44:32 -04:00
родитель 6a5b264624 fffcef0b00
Коммит e5dbd45f94
21 изменённых файлов: 187 добавлений и 180 удалений

Просмотреть файл

@@ -20,9 +20,7 @@ func TestEmojiIsValid(t *testing.T) {
Name: "name",
}
if err := emoji.IsValid(); err != nil {
t.Fatal(err)
}
require.Nil(t, emoji.IsValid())
emoji.Id = "1234"
require.NotNil(t, emoji.IsValid())

Просмотреть файл

@@ -130,6 +130,10 @@ type Manifest struct {
// A description of what your plugin is and does.
Description string `json:"description,omitempty" yaml:"description,omitempty"`
// A relative file path in the bundle that points to the plugins svg icon for use with the Plugin Marketplace.
// This should be relative to the root of your bundle and the location of the manifest file. Bitmap image formats are not supported.
IconPath string `json:"icon_path,omitempty" yaml:"icon_path,omitempty"`
// A version number for your plugin. Semantic versioning is recommended: http://semver.org
Version string `json:"version" yaml:"version"`

Просмотреть файл

@@ -64,6 +64,7 @@ func TestFindManifest(t *testing.T) {
func TestManifestUnmarshal(t *testing.T) {
expected := Manifest{
Id: "theid",
IconPath: "assets/icon.svg",
MinServerVersion: "5.6.0",
Server: &ManifestServer{
Executable: "theexecutable",
@@ -102,6 +103,7 @@ func TestManifestUnmarshal(t *testing.T) {
var yamlResult Manifest
require.NoError(t, yaml.Unmarshal([]byte(`
id: theid
icon_path: assets/icon.svg
min_server_version: 5.6.0
server:
executable: theexecutable
@@ -131,7 +133,8 @@ settings_schema:
var jsonResult Manifest
require.NoError(t, json.Unmarshal([]byte(`{
"id": "theid",
"min_server_version": "5.6.0",
"icon_path": "assets/icon.svg",
"min_server_version": "5.6.0",
"server": {
"executable": "theexecutable",
"executables": {

Просмотреть файл

@@ -24,17 +24,9 @@ func TestPostListJson(t *testing.T) {
json := pl.ToJson()
rpl := PostListFromJson(strings.NewReader(json))
if rpl.Posts[p1.Id].Message != p1.Message {
t.Fatal("failed to serialize")
}
if rpl.Posts[p2.Id].Message != p2.Message {
t.Fatal("failed to serialize")
}
if rpl.Order[1] != p2.Id {
t.Fatal("failed to serialize")
}
assert.Equal(t, p1.Message, rpl.Posts[p1.Id].Message, "failed to serialize p1 message")
assert.Equal(t, p2.Message, rpl.Posts[p2.Id].Message, "failed to serialize p2 message")
assert.Equal(t, p2.Id, rpl.Order[1], "failed to serialize p2 Id")
}
func TestPostListExtend(t *testing.T) {

Просмотреть файл

@@ -6,6 +6,8 @@ package model
import (
"strings"
"testing"
"github.com/stretchr/testify/require"
)
func TestTeamMemberJson(t *testing.T) {
@@ -13,22 +15,17 @@ func TestTeamMemberJson(t *testing.T) {
json := o.ToJson()
ro := TeamMemberFromJson(strings.NewReader(json))
if o.TeamId != ro.TeamId {
t.Fatal("Ids do not match")
}
require.Equal(t, o.TeamId, ro.TeamId, "Ids do not match")
}
func TestTeamMemberIsValid(t *testing.T) {
o := TeamMember{}
if err := o.IsValid(); err == nil {
t.Fatal("should be invalid")
}
require.Error(t, o.IsValid(), "should be invalid")
o.TeamId = NewId()
if err := o.IsValid(); err == nil {
t.Fatal("should be invalid")
}
require.Error(t, o.IsValid(), "should be invalid")
/*o.UserId = NewId()
o.Roles = "blahblah"
@@ -47,11 +44,8 @@ func TestUnreadMemberJson(t *testing.T) {
json := o.ToJson()
r := TeamUnreadFromJson(strings.NewReader(json))
if o.TeamId != r.TeamId {
t.Fatal("Ids do not match")
}
if o.MsgCount != r.MsgCount {
t.Fatal("MsgCount do not match")
}
require.Equal(t, o.TeamId, r.TeamId, "Ids do not match")
require.Equal(t, o.MsgCount, r.MsgCount, "MsgCount do not match")
}