Skip to content

Commit e79aea1

Browse files
committed
use a const (recommended by SonarQube)
1 parent 67c524e commit e79aea1

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

apikey_test.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ import (
1717
)
1818

1919
func TestApiKey_IsCorrect(t *testing.T) {
20+
const hashedSecret = "$2y$10$Y.FlUK8q//DfybgFzNG2lONaJwvEFxHnCRo/r60BZbITDT6rOUhGa"
21+
2022
tests := []struct {
2123
name string
2224
HashedSecret string
@@ -26,21 +28,21 @@ func TestApiKey_IsCorrect(t *testing.T) {
2628
}{
2729
{
2830
name: "valid secret",
29-
HashedSecret: "$2y$10$Y.FlUK8q//DfybgFzNG2lONaJwvEFxHnCRo/r60BZbITDT6rOUhGa",
31+
HashedSecret: hashedSecret,
3032
ActivatedAt: 1744896576000,
3133
Given: "abc123",
3234
wantErr: false,
3335
},
3436
{
3537
name: "invalid secret",
36-
HashedSecret: "$2y$10$Y.FlUK8q//DfybgFzNG2lONaJwvEFxHnCRo/r60BZbITDT6rOUhGa",
38+
HashedSecret: hashedSecret,
3739
ActivatedAt: 1744896576000,
3840
Given: "123abc",
3941
wantErr: true,
4042
},
4143
{
4244
name: "inactive",
43-
HashedSecret: "$2y$10$Y.FlUK8q//DfybgFzNG2lONaJwvEFxHnCRo/r60BZbITDT6rOUhGa",
45+
HashedSecret: hashedSecret,
4446
ActivatedAt: 0,
4547
Given: "abc123",
4648
wantErr: true,

0 commit comments

Comments
 (0)