github.com/rajatvaryani/mattermost-server@v5.11.1+incompatible/model/compliance_post_test.go (about) 1 // Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved. 2 // See License.txt for license information. 3 4 package model 5 6 import ( 7 "testing" 8 9 "github.com/stretchr/testify/require" 10 ) 11 12 func TestCompliancePostHeader(t *testing.T) { 13 require.Equal(t, "TeamName", CompliancePostHeader()[0]) 14 } 15 16 func TestCompliancePost(t *testing.T) { 17 o := CompliancePost{TeamName: "test", PostFileIds: "files", PostCreateAt: GetMillis()} 18 r := o.Row() 19 20 require.Equal(t, "test", r[0]) 21 require.Equal(t, "files", r[len(r)-1]) 22 } 23 24 var cleanTests = []struct { 25 in string 26 expected string 27 }{ 28 {"hello", "hello"}, 29 {"=hello", "'=hello"}, 30 {"+hello", "'+hello"}, 31 {"-hello", "'-hello"}, 32 {" =hello", "' =hello"}, 33 {" +hello", "' +hello"}, 34 {" -hello", "' -hello"}, 35 {"\t -hello", "'\t -hello"}, 36 } 37 38 func TestCleanComplianceStrings(t *testing.T) { 39 for _, tt := range cleanTests { 40 actual := cleanComplianceStrings(tt.in) 41 if actual != tt.expected { 42 t.Errorf("cleanComplianceStrings(%v): expected %v, actual %v", tt.in, tt.expected, actual) 43 } 44 } 45 }