From 9464541d61f5e8aba81fe321dc3ca9fe010ce606 Mon Sep 17 00:00:00 2001 From: Danielv123 Date: Mon, 2 Dec 2024 21:11:59 +0000 Subject: [PATCH] Update tests for multi surface support --- plugins/statistics_exporter/test/plugin.js | 35 +++++++++++++++------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/plugins/statistics_exporter/test/plugin.js b/plugins/statistics_exporter/test/plugin.js index 18251e27..5fd12c8b 100644 --- a/plugins/statistics_exporter/test/plugin.js +++ b/plugins/statistics_exporter/test/plugin.js @@ -30,18 +30,28 @@ describe("statistics_exporter plugin", function() { JSON.stringify({ game_tick: 100, player_count: 3, - force_flow_statistics: { - player: { - item_production_statistics: { - input: { "inserter": 10 }, - output: { "iron-plate": 24 }, + surface_statistics: { + "nauvis": { + game_flow_statistics: { + pollution_statistics: { + input: { "boiler": 2000 }, + output: { "tree-proxy": 560 }, + }, + }, + force_flow_statistics: { + player: { + item_production_statistics: { + input: { "inserter": 10 }, + output: { "iron-plate": 24 }, + }, + }, }, }, }, - game_flow_statistics: { - pollution_statistics: { - input: { "boiler": 2000 }, - output: { "tree-proxy": 560 }, + platforms: { + "platform-1": { + force: "player", + surface: "nauvis", }, }, }) @@ -52,11 +62,14 @@ describe("statistics_exporter plugin", function() { assert.equal(instance._instancePlayerCount.labels("7357").get(), 3); assert.equal(instance._instanceGameTicksTotal.labels("7357").get(), 100); assert.equal(instance._instanceForceFlowStatistics.labels( - "7357", "player", "item_production_statistics", "input", "inserter").get(), + "7357", "nauvis", "player", "item_production_statistics", "input", "inserter").get(), 10); assert.equal(instance._instanceGameFlowStatistics.labels( - "7357", "pollution_statistics", "input", "boiler").get(), + "7357", "nauvis", "pollution_statistics", "input", "boiler").get(), 2000); + assert.equal(instance._instancePlatformMapping.labels( + "7357", "platform-1", "player", "nauvis").get(), + 1); }); it("should pass on JSON parse errors", async function() { let string = "An error occured\n";