test(json): change all test data to json

This commit is contained in:
Slug-Boi
2025-04-02 19:27:45 +02:00
parent bddcaa9ba2
commit 36023787b4
3 changed files with 70 additions and 10 deletions
+23 -3
View File
@@ -10,9 +10,29 @@ import (
"github.com/Slug-Boi/cocommit/src/cmd/utils" "github.com/Slug-Boi/cocommit/src/cmd/utils"
) )
const author_data = `syntax for the test file const author_data = `
te|testing|TestUser|test@test.test|ex {
ti|testtest|UserName2|testing@user.io;;gr1` "Authors": {
"testing": {
"shortname": "te",
"longname": "testing",
"username": "TestUser",
"email": "test@test.test",
"ex": true,
"groups": []
},
"testtest": {
"shortname": "ti",
"longname": "testtest",
"username": "UserName2",
"email": "testing@user.io",
"ex": false,
"groups": [
"gr1"
]
}
}
}`
var envVar = utils.Find_authorfile() var envVar = utils.Find_authorfile()
+24 -4
View File
@@ -12,9 +12,29 @@ import (
"github.com/charmbracelet/x/exp/teatest" "github.com/charmbracelet/x/exp/teatest"
) )
const author_data = `syntax for the test file const author_data = `
te|testing|TestUser|test@test.test|ex;;gr0 {
ti|testtest|UserName2|testing@user.io;;gr1` "Authors": {
"testing": {
"shortname": "te",
"longname": "testing",
"username": "TestUser",
"email": "test@test.test",
"ex": true,
"groups": []
},
"testtest": {
"shortname": "ti",
"longname": "testtest",
"username": "UserName2",
"email": "testing@user.io",
"ex": false,
"groups": [
"gr1"
]
}
}
}`
var envVar string var envVar string
@@ -54,7 +74,7 @@ func TestShowUser(t *testing.T) {
teatest.WithInitialTermSize(300, 300), teatest.WithInitialTermSize(300, 300),
) )
teatest.WaitFor(t, tm.Output(), func(bts []byte) bool { teatest.WaitFor(t, tm.Output(), func(bts []byte) bool {
return bytes.Contains(bts, []byte("syntax for the test file")) return bytes.Contains(bts, []byte("\"Authors\": {"))
}, teatest.WithCheckInterval(time.Millisecond*100), teatest.WithDuration(time.Second*2)) }, teatest.WithCheckInterval(time.Millisecond*100), teatest.WithDuration(time.Second*2))
keyPress(tm, "q") keyPress(tm, "q")
+23 -3
View File
@@ -6,9 +6,29 @@ import (
"testing" "testing"
) )
const author_data = `syntax for the test file const author_data = `
te|testing|TestUser|test@test.test|ex {
ti|testtest|UserName2|testing@user.io;;gr1` "Authors": {
"testing": {
"shortname": "te",
"longname": "testing",
"username": "TestUser",
"email": "test@test.test",
"ex": true,
"groups": []
},
"testtest": {
"shortname": "ti",
"longname": "testtest",
"username": "UserName2",
"email": "testing@user.io",
"ex": false,
"groups": [
"gr1"
]
}
}
}`
var envVar = os.Getenv("author_file") var envVar = os.Getenv("author_file")