@@ -71,14 +71,15 @@ describe("module suggestions outside the core solve", () => {
7171 fx = await makeTestDb ( ) ;
7272 fx . db . exec ( `
7373 INSERT INTO items (name, display) VALUES
74- ('ore','Ore'),('plate','Plate'),('prod-module','Productivity module');
74+ ('ore','Ore'),('flux','Flux'),(' plate','Plate'),('prod-module','Productivity module');
7575 INSERT INTO recipes
7676 (name, kind, category, energy_required, allow_productivity, enabled, hidden)
7777 VALUES
7878 ('make-plate','real','crafting',1,1,1,0),
7979 ('craft-prod-module','real','crafting',1,0,1,0);
80- INSERT INTO recipe_ingredients (recipe, idx, kind, name, amount)
81- VALUES ('make-plate',0,'item','ore',1);
80+ INSERT INTO recipe_ingredients (recipe, idx, kind, name, amount) VALUES
81+ ('make-plate',0,'item','ore',1),
82+ ('make-plate',1,'item','flux',2);
8283 INSERT INTO recipe_products (recipe, idx, kind, name, amount) VALUES
8384 ('make-plate',0,'item','plate',1),
8485 ('craft-prod-module',0,'item','prod-module',1);
@@ -113,6 +114,19 @@ describe("module suggestions outside the core solve", () => {
113114 ] ) ,
114115 ) . toEqual ( { "make-plate" : [ "prod-module" , "prod-module" ] } ) ;
115116 } ) ;
117+
118+ it ( "displays electricity first, then imports by descending rate" , async ( ) => {
119+ const solved = await computeBlock ( {
120+ goals : [ { name : "plate" , rate : 1 } ] ,
121+ recipes : [ "make-plate" ] ,
122+ } ) ;
123+
124+ expect ( solved . displayImports . map ( ( { name, rate } ) => ( { name, rate } ) ) ) . toEqual ( [
125+ { name : "pyops-electricity" , rate : 0.1 } ,
126+ { name : "flux" , rate : 2 } ,
127+ { name : "ore" , rate : 1 } ,
128+ ] ) ;
129+ } ) ;
116130} ) ;
117131
118132describe ( "incidental spoilage stays outside the nominal block solve" , ( ) => {
0 commit comments