summaryrefslogtreecommitdiffstats
path: root/model/compliance_post_test.go
diff options
context:
space:
mode:
authorJesse Hallam <jesse.hallam@gmail.com>2018-08-09 05:26:38 -0400
committerJesús Espino <jespinog@gmail.com>2018-08-09 11:26:38 +0200
commitd8c8a19d355fdd67a984fc696269521919bb58b5 (patch)
treecb32477ac9031ae9e742434f7a2455d42e56da65 /model/compliance_post_test.go
parent0bbabd137bdbe04653426a1731bd8eb9225e0249 (diff)
downloadchat-d8c8a19d355fdd67a984fc696269521919bb58b5.tar.gz
chat-d8c8a19d355fdd67a984fc696269521919bb58b5.tar.bz2
chat-d8c8a19d355fdd67a984fc696269521919bb58b5.zip
avoid t.Fatal() in tests (#9189)
I've been burned a few times by tests that simply fatal, requiring me to run another build to learn more about what the mismatch was. Avoid this. This is part of a long running goal of mine to make testing "better".
Diffstat (limited to 'model/compliance_post_test.go')
-rw-r--r--model/compliance_post_test.go15
1 files changed, 5 insertions, 10 deletions
diff --git a/model/compliance_post_test.go b/model/compliance_post_test.go
index ff159ef1b..21044c128 100644
--- a/model/compliance_post_test.go
+++ b/model/compliance_post_test.go
@@ -5,25 +5,20 @@ package model
import (
"testing"
+
+ "github.com/stretchr/testify/require"
)
func TestCompliancePostHeader(t *testing.T) {
- if CompliancePostHeader()[0] != "TeamName" {
- t.Fatal()
- }
+ require.Equal(t, "TeamName", CompliancePostHeader()[0])
}
func TestCompliancePost(t *testing.T) {
o := CompliancePost{TeamName: "test", PostFileIds: "files", PostCreateAt: GetMillis()}
r := o.Row()
- if r[0] != "test" {
- t.Fatal()
- }
-
- if r[len(r)-1] != "files" {
- t.Fatal()
- }
+ require.Equal(t, "test", r[0])
+ require.Equal(t, "files", r[len(r)-1])
}
var cleanTests = []struct {