11import { createInstrumentGroups } from "@/app/components/InstrumentsDisplay" ;
2- import { targetStation } from "@/app/types" ;
2+ import { instList } from "@/app/types" ;
33
44test ( "createInstrumentGroups adds two instruments from different target stations to the same science group" , ( ) => {
55 const instrument1Name = "INST1" ;
66 const instrument2Name = "INST2" ;
77 const commonScienceGroup = "MOLSPEC" ;
88 const instrument1 = {
99 name : instrument1Name ,
10- scienceGroups : [ commonScienceGroup ] ,
10+ groups : [ commonScienceGroup ] ,
11+ targetStation : "TS0" ,
12+ hostName : "" ,
13+ pvPrefix : "" ,
14+ isScheduled : true ,
15+ seci : false ,
16+ runStatePV : "" ,
17+ runStateValue : "" ,
1118 } ;
1219 const instrument2 = {
1320 name : instrument2Name ,
14- scienceGroups : [ commonScienceGroup ] ,
21+ groups : [ commonScienceGroup ] ,
22+ targetStation : "TS0" ,
23+ hostName : "" ,
24+ pvPrefix : "" ,
25+ isScheduled : true ,
26+ seci : false ,
27+ runStatePV : "" ,
28+ runStateValue : "" ,
1529 } ;
16- const targetStations : Array < targetStation > = [
17- { targetStation : "TS0" , instruments : [ instrument1 ] } ,
18- { targetStation : "TS3" , instruments : [ instrument2 ] } ,
19- ] ;
30+ const targetStations : instList = [ instrument1 , instrument2 ] ;
2031 const result = createInstrumentGroups ( targetStations ) ;
2132
2233 expect ( result . get ( commonScienceGroup ) ! . sort ( ) ) . toStrictEqual (
@@ -29,13 +40,27 @@ test("createInstrumentGroups ignores instrument without any groups", () => {
2940 const commonScienceGroup = "MOLSPEC" ;
3041 const instrument1 = {
3142 name : instrument1Name ,
32- scienceGroups : [ commonScienceGroup ] ,
43+ groups : [ commonScienceGroup ] ,
44+ targetStation : "TS0" ,
45+ hostName : "" ,
46+ pvPrefix : "" ,
47+ isScheduled : true ,
48+ seci : false ,
49+ runStatePV : "" ,
50+ runStateValue : "" ,
3351 } ;
34- const instrument2 = { name : "someinstrumentwithnogroups" , scienceGroups : [ ] } ;
35- const targetStations : Array < targetStation > = [
36- { targetStation : "TS0" , instruments : [ instrument1 ] } ,
37- { targetStation : "TS3" , instruments : [ instrument2 ] } ,
38- ] ;
52+ const instrument2 = {
53+ name : "someinstrumentwithnogroups" ,
54+ targetStation : "TS0" ,
55+ hostName : "" ,
56+ pvPrefix : "" ,
57+ isScheduled : true ,
58+ seci : false ,
59+ runStatePV : "" ,
60+ runStateValue : "" ,
61+ groups : [ ] ,
62+ } ;
63+ const targetStations : instList = [ instrument1 , instrument2 ] ;
3964 const result = createInstrumentGroups ( targetStations ) ;
4065
4166 expect ( result . get ( commonScienceGroup ) ! . sort ( ) ) . toStrictEqual (
@@ -48,16 +73,27 @@ test("createInstrumentGroups ignores instrument which is a support machine", ()
4873 const commonScienceGroup = "MOLSPEC" ;
4974 const instrument1 = {
5075 name : instrument1Name ,
51- scienceGroups : [ commonScienceGroup ] ,
76+ groups : [ commonScienceGroup ] ,
77+ targetStation : "TS0" ,
78+ hostName : "" ,
79+ pvPrefix : "" ,
80+ isScheduled : true ,
81+ seci : false ,
82+ runStatePV : "" ,
83+ runStateValue : "" ,
5284 } ;
5385 const instrument2 = {
5486 name : "someinstrumentwithnogroups" ,
55- scienceGroups : [ "SUPPORT" ] ,
87+ groups : [ "SUPPORT" ] ,
88+ targetStation : "TS3" ,
89+ hostName : "" ,
90+ pvPrefix : "" ,
91+ isScheduled : true ,
92+ seci : false ,
93+ runStatePV : "" ,
94+ runStateValue : "" ,
5695 } ;
57- const targetStations : Array < targetStation > = [
58- { targetStation : "TS0" , instruments : [ instrument1 ] } ,
59- { targetStation : "TS3" , instruments : [ instrument2 ] } ,
60- ] ;
96+ const targetStations : instList = [ instrument1 , instrument2 ] ;
6197 const result = createInstrumentGroups ( targetStations ) ;
6298
6399 expect ( result . get ( commonScienceGroup ) ! . sort ( ) ) . toStrictEqual (
0 commit comments