utils.TestCenterString_WithEmptyString   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 3
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
package utils
2
3
import (
4
	"testing"
5
6
	"github.com/stretchr/testify/assert"
7
)
8
9
func TestCenterString_WithNormalString(t *testing.T) {
10
	result := CenterString("test", 10)
11
	assert.Equal(t, "   test   ", result)
12
}
13
14
func TestCenterString_WithEmptyString(t *testing.T) {
15
	result := CenterString("", 10)
16
	assert.Equal(t, "          ", result)
17
}
18
19
func TestCenterString_WithCenteredString(t *testing.T) {
20
	result := CenterString("   test   ", 10)
21
	assert.Equal(t, "   test   ", result)
22
}
23
24
func TestCenterString_WithLongString(t *testing.T) {
25
	result := CenterString("this is a long string", 10)
26
	assert.Equal(t, "this is a long string", result)
27
}
28
29
func TestCenterString_WithOddWidth(t *testing.T) {
30
	result := CenterString("test", 11)
31
	assert.Equal(t, "   test    ", result)
32
}
33
34
func TestObscureToken_WithShortToken(t *testing.T) {
35
	result := ObscureToken("test")
36
	assert.Equal(t, "test", result)
37
}
38
39
func TestObscureToken_WithLongToken(t *testing.T) {
40
	result := ObscureToken("thisisaverylongtokenthisisaverylongtoken")
41
	assert.Equal(t, "thisisaverylon...oken", result)
42
}
43