(
t *testing.T,
prompt []interface{},
firstID string,
secondID string,
)
| 631 | } |
| 632 | |
| 633 | func requirePromptItemReferenceOrder( |
| 634 | t *testing.T, |
| 635 | prompt []interface{}, |
| 636 | firstID string, |
| 637 | secondID string, |
| 638 | ) { |
| 639 | t.Helper() |
| 640 | firstIndex := -1 |
| 641 | secondIndex := -1 |
| 642 | for index, item := range prompt { |
| 643 | itemMap, ok := item.(map[string]interface{}) |
| 644 | if !ok { |
| 645 | continue |
| 646 | } |
| 647 | itemID := chattest.StringResponseField(itemMap, "id") |
| 648 | if itemID == "" { |
| 649 | itemID = chattest.StringResponseField(itemMap, "item_id") |
| 650 | } |
| 651 | switch itemID { |
| 652 | case firstID: |
| 653 | firstIndex = index |
| 654 | case secondID: |
| 655 | secondIndex = index |
| 656 | } |
| 657 | } |
| 658 | require.NotEqual(t, -1, firstIndex, "missing first item reference") |
| 659 | require.NotEqual(t, -1, secondIndex, "missing second item reference") |
| 660 | require.Less(t, firstIndex, secondIndex) |
| 661 | } |
no test coverage detected