mirror of
https://github.com/Slug-Boi/cocommit.git
synced 2026-05-13 12:45:47 +00:00
test: add scope and set scope to be local in all tests
This commit is contained in:
@@ -387,7 +387,7 @@ func (m Model) View() string {
|
|||||||
|
|
||||||
const title_text = "Select authors to add to commit \t|\t"
|
const title_text = "Select authors to add to commit \t|\t"
|
||||||
|
|
||||||
func listModel() Model {
|
func listModel(scope ...int) Model {
|
||||||
|
|
||||||
selected = map[string]item{}
|
selected = map[string]item{}
|
||||||
|
|
||||||
@@ -396,7 +396,10 @@ func listModel() Model {
|
|||||||
listKeys := newListKeyMap()
|
listKeys := newListKeyMap()
|
||||||
|
|
||||||
// Add items to the list
|
// Add items to the list
|
||||||
items := generate_list(git_scope)
|
if len(scope) == 0 {
|
||||||
|
scope = append(scope, git_scope)
|
||||||
|
}
|
||||||
|
items := generate_list(scope[0])
|
||||||
|
|
||||||
sort.Slice(items, func(i, j int) bool {
|
sort.Slice(items, func(i, j int) bool {
|
||||||
return items[i].(item) < items[j].(item)
|
return items[i].(item) < items[j].(item)
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ func TestEntryTA(t *testing.T) {
|
|||||||
setup()
|
setup()
|
||||||
defer teardown()
|
defer teardown()
|
||||||
|
|
||||||
m := listModel()
|
m := listModel(local_scope)
|
||||||
|
|
||||||
// m := tempAuthorModel(&old_m)
|
// m := tempAuthorModel(&old_m)
|
||||||
tm := teatest.NewTestModel(
|
tm := teatest.NewTestModel(
|
||||||
@@ -218,7 +218,7 @@ func Test_EntryCA_TriggerError(t *testing.T) {
|
|||||||
setup()
|
setup()
|
||||||
defer teardown()
|
defer teardown()
|
||||||
|
|
||||||
m := listModel()
|
m := listModel(local_scope)
|
||||||
|
|
||||||
tm := teatest.NewTestModel(
|
tm := teatest.NewTestModel(
|
||||||
t, m, teatest.WithInitialTermSize(300, 300),
|
t, m, teatest.WithInitialTermSize(300, 300),
|
||||||
@@ -256,7 +256,7 @@ func Test_EntryCA(t *testing.T) {
|
|||||||
setup()
|
setup()
|
||||||
defer teardown()
|
defer teardown()
|
||||||
|
|
||||||
m := listModel()
|
m := listModel(local_scope)
|
||||||
|
|
||||||
// mm := createAuthorModel(&m)
|
// mm := createAuthorModel(&m)
|
||||||
tm := teatest.NewTestModel(
|
tm := teatest.NewTestModel(
|
||||||
@@ -598,7 +598,7 @@ func Test_EntrySelectUsers(t *testing.T) {
|
|||||||
|
|
||||||
utils.Define_users("author_file_test")
|
utils.Define_users("author_file_test")
|
||||||
|
|
||||||
m := listModel()
|
m := listModel(local_scope)
|
||||||
tm := teatest.NewTestModel(
|
tm := teatest.NewTestModel(
|
||||||
t, m, teatest.WithInitialTermSize(300, 300),
|
t, m, teatest.WithInitialTermSize(300, 300),
|
||||||
)
|
)
|
||||||
@@ -628,7 +628,7 @@ func Test_EntrySelectAll(t *testing.T) {
|
|||||||
|
|
||||||
utils.Define_users("author_file_test")
|
utils.Define_users("author_file_test")
|
||||||
|
|
||||||
m := listModel()
|
m := listModel(local_scope)
|
||||||
tm := teatest.NewTestModel(
|
tm := teatest.NewTestModel(
|
||||||
t, m, teatest.WithInitialTermSize(300, 300),
|
t, m, teatest.WithInitialTermSize(300, 300),
|
||||||
)
|
)
|
||||||
@@ -657,7 +657,7 @@ func Test_EntryNegation(t *testing.T) {
|
|||||||
|
|
||||||
utils.Define_users("author_file_test")
|
utils.Define_users("author_file_test")
|
||||||
|
|
||||||
m := listModel()
|
m := listModel(local_scope)
|
||||||
tm := teatest.NewTestModel(
|
tm := teatest.NewTestModel(
|
||||||
t, m, teatest.WithInitialTermSize(300, 300),
|
t, m, teatest.WithInitialTermSize(300, 300),
|
||||||
)
|
)
|
||||||
@@ -686,7 +686,7 @@ func Test_EntryDeleteAuthor(t *testing.T) {
|
|||||||
|
|
||||||
utils.Define_users("author_file_test")
|
utils.Define_users("author_file_test")
|
||||||
|
|
||||||
m := listModel()
|
m := listModel(local_scope)
|
||||||
tm := teatest.NewTestModel(
|
tm := teatest.NewTestModel(
|
||||||
t, m, teatest.WithInitialTermSize(300, 300),
|
t, m, teatest.WithInitialTermSize(300, 300),
|
||||||
)
|
)
|
||||||
@@ -719,7 +719,7 @@ func Test_GroupSelection(t *testing.T) {
|
|||||||
setup()
|
setup()
|
||||||
defer teardown()
|
defer teardown()
|
||||||
|
|
||||||
m := listModel()
|
m := listModel(local_scope)
|
||||||
tm := teatest.NewTestModel(
|
tm := teatest.NewTestModel(
|
||||||
t, m, teatest.WithInitialTermSize(300, 300),
|
t, m, teatest.WithInitialTermSize(300, 300),
|
||||||
)
|
)
|
||||||
@@ -756,7 +756,7 @@ func Test_pagination(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m := listModel()
|
m := listModel(local_scope)
|
||||||
|
|
||||||
tm := teatest.NewTestModel(
|
tm := teatest.NewTestModel(
|
||||||
t, m, teatest.WithInitialTermSize(25, 25),
|
t, m, teatest.WithInitialTermSize(25, 25),
|
||||||
|
|||||||
Reference in New Issue
Block a user