Files
Hornwitser 5dcaca4d0b Migrate to ECMAScript Modules
Migrate the usage of CommonJS specific code and imports to ESM.  Roughly
summarised this:
- Changes all require() calls to import statement or expressions.
- Changes usage of module.exports to export statements.
- Replaces require.resolve with import.meta.resolve.
- Replaces conditional imports with conditional subpath imports.
- Replaces module === require.main with import.meta.main.
- Adds the full filename with extention to all relative imports.
- Changes all usage of __dirname and __filename to their import.meta
  equivalents.
- Sets "type": "module" in package.json files.
- Removes usage of "use strict".
- Adds .ts an an alias of .js for the webpack build.

Due to differences in how require and import resolves files the plugin
entrypoints will have to include the filename and extension after this
migration in order to work.
2026-09-11 22:43:57 +02:00

27 lines
944 B
JavaScript

import assert from "node:assert/strict";
import * as routes from "../dist/node/routes.js";
import { get } from "../../../test/integration/index.js";
describe("subspace_storage endpoints", function() {
describe("GET /api/inventory", function() {
it("should return the controllers current inventory", async function() {
let res = await get("/api/inventory");
let inventory = await res.json();
assert.equal(typeof inventory, "object", "Inventory should be an object");
return; // XXX Disabled until a suitable test interface is added.
assert(inventory.length >= 1, "There should be at least 1 entry in the inventory");
let contains20SteelPlate = false;
inventory.forEach(itemStack => {
if (itemStack.name === "steel-plate" && itemStack.count >= 20) {
contains20SteelPlate = true;
}
});
assert(contains20SteelPlate, "Please ensure there are at least 20 steel plate in the inventory");
});
});
});