chore: adds tests
This commit is contained in:
35
tests/__mocks__/screeps.ts
Normal file
35
tests/__mocks__/screeps.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* Minimal Screeps global mocks used across tests.
|
||||
*/
|
||||
|
||||
// Constants
|
||||
(global as any).RESOURCE_ENERGY = 'energy';
|
||||
(global as any).ERR_NOT_IN_RANGE = -9;
|
||||
(global as any).OK = 0;
|
||||
(global as any).WORK = 'work';
|
||||
(global as any).CARRY = 'carry';
|
||||
(global as any).MOVE = 'move';
|
||||
|
||||
// RoomPosition constructor mock
|
||||
(global as any).RoomPosition = class RoomPosition {
|
||||
x: number;
|
||||
y: number;
|
||||
roomName: string;
|
||||
|
||||
constructor(x: number, y: number, roomName: string) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.roomName = roomName;
|
||||
}
|
||||
|
||||
getRangeTo(_target: any): number {
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
// Game mock
|
||||
(global as any).Game = {
|
||||
getObjectById: jest.fn(),
|
||||
};
|
||||
|
||||
export {};
|
||||
Reference in New Issue
Block a user