Passed
Push — main ( 7310eb...4f3fcd )
by Clive
03:28
created

internal/utils/helper_test.go   A

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
cc 5
eloc 19
dl 0
loc 31
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A utils.TestCenterString_WithOddWidth 0 3 1
A utils.TestCenterString_WithLongString 0 3 1
A utils.TestCenterString_WithNormalString 0 3 1
A utils.TestCenterString_WithCenteredString 0 3 1
A utils.TestCenterString_WithEmptyString 0 3 1
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