github.com/mattermost/mattermost-server/v5@v5.39.3/store/storetest/utils_test.go (about)

     1  // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
     2  // See LICENSE.txt for license information.
     3  
     4  package storetest
     5  
     6  import (
     7  	"regexp"
     8  	"testing"
     9  
    10  	"github.com/stretchr/testify/require"
    11  )
    12  
    13  func TestNewTestId(t *testing.T) {
    14  	rg := regexp.MustCompile(`(\S\d){13}`)
    15  
    16  	for i := 0; i < 1000; i++ {
    17  		id := NewTestId()
    18  		require.LessOrEqual(t, len(id), 26, "test ids shouldn't be longer than 26 chars")
    19  		require.Regexp(t, rg, id, "test ids should have pattern e.g a1b2c3...")
    20  	}
    21  }