Unit test for: Automatically delete memory of missing creeps (#158)
This commit is contained in:
@@ -22,4 +22,16 @@ describe("main", () => {
|
|||||||
it("should return void when called with no context", () => {
|
it("should return void when called with no context", () => {
|
||||||
assert.isUndefined(loop());
|
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);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,10 +1,17 @@
|
|||||||
export const Game = {
|
export const Game: {
|
||||||
creeps: [],
|
creeps: { [name: string]: any };
|
||||||
|
rooms: any;
|
||||||
|
spawns: any;
|
||||||
|
time: any;
|
||||||
|
} = {
|
||||||
|
creeps: {},
|
||||||
rooms: [],
|
rooms: [],
|
||||||
spawns: {},
|
spawns: {},
|
||||||
time: 12345
|
time: 12345
|
||||||
};
|
};
|
||||||
|
|
||||||
export const Memory = {
|
export const Memory: {
|
||||||
creeps: []
|
creeps: { [name: string]: any };
|
||||||
|
} = {
|
||||||
|
creeps: {}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user