@@ -9,46 +9,46 @@ class CoderWorkspacesStepViewTest extends Specification {
99 def table = new WorkspacesTable ()
1010 table. listTableModel. items = List . of(
1111 // An off workspace.
12- DataGen . workspace (" ws1" , " ws1" ),
12+ DataGen . workspaceAgentModel (" ws1" , " ws1" ),
1313
1414 // On workspaces.
15- DataGen . workspace (" agent1" , " ws2" ),
16- DataGen . workspace (" agent2" , " ws2" ),
17- DataGen . workspace (" agent3" , " ws3" ),
15+ DataGen . workspaceAgentModel (" agent1" , " ws2" ),
16+ DataGen . workspaceAgentModel (" agent2" , " ws2" ),
17+ DataGen . workspaceAgentModel (" agent3" , " ws3" ),
1818
1919 // Another off workspace.
20- DataGen . workspace (" ws4" , " ws4" ),
20+ DataGen . workspaceAgentModel (" ws4" , " ws4" ),
2121
2222 // In practice we do not list both agents and workspaces
2323 // together but here test that anyway with an agent first and
2424 // then with a workspace first.
25- DataGen . workspace (" agent2" , " ws5" ),
26- DataGen . workspace (" ws5" , " ws5" ),
27- DataGen . workspace (" ws6" , " ws6" ),
28- DataGen . workspace (" agent3" , " ws6" ),
25+ DataGen . workspaceAgentModel (" agent2" , " ws5" ),
26+ DataGen . workspaceAgentModel (" ws5" , " ws5" ),
27+ DataGen . workspaceAgentModel (" ws6" , " ws6" ),
28+ DataGen . workspaceAgentModel (" agent3" , " ws6" ),
2929 )
3030
3131 expect :
3232 table. getNewSelection(selected) == expected
3333
3434 where :
35- selected | expected
36- null | -1 // No selection.
37- DataGen . workspace (" gone" , " gone" ) | -1 // No workspace that matches.
38- DataGen . workspace (" ws1" , " ws1" ) | 0 // Workspace exact match.
39- DataGen . workspace (" gone" , " ws1" ) | 0 // Agent gone, select workspace.
40- DataGen . workspace (" ws2" , " ws2" ) | 1 // Workspace gone, select first agent.
41- DataGen . workspace (" agent1" , " ws2" ) | 1 // Agent exact match.
42- DataGen . workspace (" agent2" , " ws2" ) | 2 // Agent exact match.
43- DataGen . workspace (" ws3" , " ws3" ) | 3 // Workspace gone, select first agent.
44- DataGen . workspace (" agent3" , " ws3" ) | 3 // Agent exact match.
45- DataGen . workspace (" gone" , " ws4" ) | 4 // Agent gone, select workspace.
46- DataGen . workspace (" ws4" , " ws4" ) | 4 // Workspace exact match.
47- DataGen . workspace (" agent2" , " ws5" ) | 5 // Agent exact match.
48- DataGen . workspace (" gone" , " ws5" ) | 5 // Agent gone, another agent comes first.
49- DataGen . workspace (" ws5" , " ws5" ) | 6 // Workspace exact match.
50- DataGen . workspace (" ws6" , " ws6" ) | 7 // Workspace exact match.
51- DataGen . workspace (" gone" , " ws6" ) | 7 // Agent gone, workspace comes first.
52- DataGen . workspace (" agent3" , " ws6" ) | 8 // Agent exact match.
35+ selected | expected
36+ null | -1 // No selection.
37+ DataGen . workspaceAgentModel (" gone" , " gone" ) | -1 // No workspace that matches.
38+ DataGen . workspaceAgentModel (" ws1" , " ws1" ) | 0 // Workspace exact match.
39+ DataGen . workspaceAgentModel (" gone" , " ws1" ) | 0 // Agent gone, select workspace.
40+ DataGen . workspaceAgentModel (" ws2" , " ws2" ) | 1 // Workspace gone, select first agent.
41+ DataGen . workspaceAgentModel (" agent1" , " ws2" ) | 1 // Agent exact match.
42+ DataGen . workspaceAgentModel (" agent2" , " ws2" ) | 2 // Agent exact match.
43+ DataGen . workspaceAgentModel (" ws3" , " ws3" ) | 3 // Workspace gone, select first agent.
44+ DataGen . workspaceAgentModel (" agent3" , " ws3" ) | 3 // Agent exact match.
45+ DataGen . workspaceAgentModel (" gone" , " ws4" ) | 4 // Agent gone, select workspace.
46+ DataGen . workspaceAgentModel (" ws4" , " ws4" ) | 4 // Workspace exact match.
47+ DataGen . workspaceAgentModel (" agent2" , " ws5" ) | 5 // Agent exact match.
48+ DataGen . workspaceAgentModel (" gone" , " ws5" ) | 5 // Agent gone, another agent comes first.
49+ DataGen . workspaceAgentModel (" ws5" , " ws5" ) | 6 // Workspace exact match.
50+ DataGen . workspaceAgentModel (" ws6" , " ws6" ) | 7 // Workspace exact match.
51+ DataGen . workspaceAgentModel (" gone" , " ws6" ) | 7 // Agent gone, workspace comes first.
52+ DataGen . workspaceAgentModel (" agent3" , " ws6" ) | 8 // Agent exact match.
5353 }
5454}
0 commit comments