From dda6942228a6a3f4b46f76904b26eff9979eeaaa Mon Sep 17 00:00:00 2001 From: Vitor Hideyoshi Date: Thu, 23 Apr 2026 23:14:21 -0300 Subject: [PATCH] chore: removes unecessary files --- .prettierrc | 9 ---- .screeps.example.yml | 15 ------- test/integration/helper.ts | 65 ---------------------------- test/integration/integration.test.ts | 18 -------- test/mocha.opts | 14 ------ test/setup-mocha.js | 9 ---- test/unit/main.test.ts | 37 ---------------- test/unit/mock.ts | 17 -------- 8 files changed, 184 deletions(-) delete mode 100644 .prettierrc delete mode 100644 .screeps.example.yml delete mode 100644 test/integration/helper.ts delete mode 100644 test/integration/integration.test.ts delete mode 100644 test/mocha.opts delete mode 100644 test/setup-mocha.js delete mode 100644 test/unit/main.test.ts delete mode 100644 test/unit/mock.ts diff --git a/.prettierrc b/.prettierrc deleted file mode 100644 index 3cdfd8c..0000000 --- a/.prettierrc +++ /dev/null @@ -1,9 +0,0 @@ -{ - "semi": true, - "tabWidth": 4, - "printWidth": 120, - "singleQuote": false, - "trailingComma": "none", - "arrowParens": "avoid", - "endOfLine": "auto" -} diff --git a/.screeps.example.yml b/.screeps.example.yml deleted file mode 100644 index 38abb75..0000000 --- a/.screeps.example.yml +++ /dev/null @@ -1,15 +0,0 @@ -servers: - main: - host: screeps.com - secure: true - token: { TOKEN } - ptr: - host: screeps.com - secure: true - token: { TOKEN } - ptr: true - -configs: - screepsconsole: - maxHistory: 20000 - maxScroll: 20000 diff --git a/test/integration/helper.ts b/test/integration/helper.ts deleted file mode 100644 index 67c2578..0000000 --- a/test/integration/helper.ts +++ /dev/null @@ -1,65 +0,0 @@ -const { readFileSync } = require('fs'); -const _ = require('lodash'); -const { ScreepsServer, stdHooks } = require('screeps-server-mockup'); -const DIST_MAIN_JS = 'dist/main.js'; - -/* - * Helper class for creating a ScreepsServer and resetting it between tests. - * See https://github.com/Hiryus/screeps-server-mockup for instructions on - * manipulating the terrain and game state. - */ -class IntegrationTestHelper { - private _server: any; - private _player: any; - - get server() { - return this._server; - } - - get player() { - return this._player; - } - - async beforeEach() { - this._server = new ScreepsServer(); - - // reset world but add invaders and source keepers bots - await this._server.world.reset(); - - // create a stub world composed of 9 rooms with sources and controller - await this._server.world.stubWorld(); - - // add a player with the built dist/main.js file - const modules = { - main: readFileSync(DIST_MAIN_JS).toString(), - }; - this._player = await this._server.world.addBot({ - username: 'player', - room: 'W0N1', - x: 15, - y: 15, - modules, - }); - - // Start server - await this._server.start(); - } - - async afterEach() { - await this._server.stop(); - } -} - -beforeEach(async () => { - await helper.beforeEach(); -}); - -afterEach(async () => { - await helper.afterEach(); -}); - -before(() => { - stdHooks.hookWrite(); -}); - -export const helper = new IntegrationTestHelper(); diff --git a/test/integration/integration.test.ts b/test/integration/integration.test.ts deleted file mode 100644 index a033e1e..0000000 --- a/test/integration/integration.test.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { helper } from './helper'; -import { assert } from 'chai'; - -describe('main', () => { - it('runs a server and matches the game tick', async function () { - for (let i = 1; i < 10; i += 1) { - assert.equal(await helper.server.world.gameTime, i); - await helper.server.tick(); - } - }); - - it('writes and reads to memory', async function () { - await helper.player.console(`Memory.foo = 'bar'`); - await helper.server.tick(); - const memory = JSON.parse(await helper.player.memory); - assert.equal(memory.foo, 'bar'); - }); -}); diff --git a/test/mocha.opts b/test/mocha.opts deleted file mode 100644 index d387698..0000000 --- a/test/mocha.opts +++ /dev/null @@ -1,14 +0,0 @@ ---require test/setup-mocha.js ---require ts-node/register ---require tsconfig-paths/register ---ui bdd - ---reporter spec ---bail ---full-trace ---watch-extensions tsx,ts ---colors - ---recursive ---timeout 5000 ---exit diff --git a/test/setup-mocha.js b/test/setup-mocha.js deleted file mode 100644 index 87dd07d..0000000 --- a/test/setup-mocha.js +++ /dev/null @@ -1,9 +0,0 @@ -//inject mocha globally to allow custom interface refer without direct import - bypass bundle issue -global._ = require('lodash'); -global.mocha = require('mocha'); -global.chai = require('chai'); -global.sinon = require('sinon'); -global.chai.use(require('sinon-chai')); - -// Override ts-node compiler options -process.env.TS_NODE_PROJECT = 'tsconfig.test.json'; diff --git a/test/unit/main.test.ts b/test/unit/main.test.ts deleted file mode 100644 index dd72f05..0000000 --- a/test/unit/main.test.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { loop } from '../../src/main'; -import { Game, Memory } from './mock'; -import { assert } from 'chai'; - -describe('main', () => { - before(() => { - // runs before all test in this block - }); - - beforeEach(() => { - // runs before each test in this block - // @ts-ignore : allow adding Game to global - global.Game = _.clone(Game); - // @ts-ignore : allow adding Memory to global - global.Memory = _.clone(Memory); - }); - - it('should export a loop function', () => { - assert.isTrue(typeof loop === 'function'); - }); - - it('should return void when called with no context', () => { - assert.isUndefined(loop()); - }); - - it('Automatically delete memory of missing creeps', () => { - Memory.creeps.persistValue = 'any value'; - Memory.creeps.notPersistValue = 'any value'; - - Game.creeps.persistValue = 'any value'; - - loop(); - - assert.isDefined(Memory.creeps.persistValue); - assert.isUndefined(Memory.creeps.notPersistValue); - }); -}); diff --git a/test/unit/mock.ts b/test/unit/mock.ts deleted file mode 100644 index 0c2c7ed..0000000 --- a/test/unit/mock.ts +++ /dev/null @@ -1,17 +0,0 @@ -export const Game: { - creeps: { [name: string]: any }; - rooms: any; - spawns: any; - time: any; -} = { - creeps: {}, - rooms: [], - spawns: {}, - time: 12345, -}; - -export const Memory: { - creeps: { [name: string]: any }; -} = { - creeps: {}, -};