Skip to content

Commit

Permalink
fix: fixed lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
SFilinsky committed Mar 14, 2022
1 parent 9a5cf91 commit dac66ec
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 19 deletions.
1 change: 1 addition & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"rules": {
"@typescript-eslint/no-explicit-any": "error",

"@typescript-eslint/ban-types": "warn",
"@typescript-eslint/no-empty-function": "warn",
"@typescript-eslint/explicit-module-boundary-types": "warn",

Expand Down
20 changes: 10 additions & 10 deletions src/ecr/ecr/ecr.api.tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export namespace ECRApiTools {
},
commands: [],
});
})
});

});

Expand Down Expand Up @@ -234,7 +234,7 @@ export namespace ECRApiTools {

test("Should call custom command handlers", () => {
const handlerEffect = jest.fn((command, store) => {});
const handler = createCommandHandler(CreateEntityWithComponentsCommand, handlerEffect)
const handler = createCommandHandler(CreateEntityWithComponentsCommand, handlerEffect);
ecr.addCustomCommandHandler(handler);
const command = new CreateEntityWithComponentsCommand([]);
ecr.injectCommands([ command ]);
Expand All @@ -254,7 +254,7 @@ export namespace ECRApiTools {
removePrototype(new TestComponent(2)),
removePrototype(new TestComponent(3)),
removePrototype(new TestComponent(4)),
]
];
ecr.injectCommands([ new CreateEntityWithComponentsCommand(components) ]);
const snapshot = ecr.runSimulationTick().snapshot;
expect(snapshot.entities).toHaveLength(1);
Expand Down Expand Up @@ -320,10 +320,10 @@ export namespace ECRApiTools {
'testResource1': removePrototype(new TestResource(1)),
'testResource2': removePrototype(new TestResource2(2)),
}
}
};

ecr.injectCommands([ new LoadSnapshotCommand(testSnapshot) ]);
})
});

test("Should check custom rule condition", () => {
const condition = jest.fn(() => true);
Expand All @@ -332,10 +332,10 @@ export namespace ECRApiTools {
query: emptyQuery,
condition,
body
})
});
ecr.runSimulationTick();
expect(condition).toBeCalledTimes(1);
})
});

test("Should call custom rule body when condition returns true", () => {
const condition = jest.fn(() => true);
Expand All @@ -344,7 +344,7 @@ export namespace ECRApiTools {
query: emptyQuery,
condition,
body
})
});
ecr.runSimulationTick();
expect(body).toBeCalledTimes(1);
});
Expand All @@ -355,7 +355,7 @@ export namespace ECRApiTools {
condition: jest.fn(() => false),
body: jest.fn(() => {})
});
ecr.addRule(rule)
ecr.addRule(rule);
ecr.runSimulationTick();
expect(rule.body).not.toBeCalled();
});
Expand Down Expand Up @@ -445,7 +445,7 @@ export namespace ECRApiTools {

});

})
});

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ export class SimpleClientSimulation extends ClientSimulationApi {
}

public applyServerUpdate(snapshot: WorldStateSnapshot): void {
this.ecr.injectCommands([ new LoadSnapshotCommand(snapshot) ])
this.ecr.injectCommands([ new LoadSnapshotCommand(snapshot) ]);
}
}
16 changes: 8 additions & 8 deletions src/typing/WSCStructure.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe("Typing tools", () => {
expect(getTypeName(SomeClass)).toBe("SomeClass");
});

})
});


describe("getObjectType", () => {
Expand All @@ -34,33 +34,33 @@ describe("Typing tools", () => {
expect(getObjectType(obj)).toBe("SomeClass");
});

})
});

describe("isTypeOf", () => {

test("Should return true when the given type is in object's typeChain", () => {
const obj = removePrototype(new SomeClass2());
expect(isTypeOf(obj, SomeClass)).toBeTruthy();
})
});

test("Should return false when the given type is not in object's typeChain", () => {
const obj = removePrototype(new SomeClass3());
expect(isTypeOf(obj, SomeClass2)).toBeFalsy();
})
});

})
});

describe("isSameType", () => {
test("Should return true when objects are of same type", () => {
const obj = removePrototype(new SomeClass2());
const obj2 = removePrototype(new SomeClass2());
expect(isSameType(obj, obj2)).toBeTruthy();
})
});

test("Should return false when objects are of different type", () => {
const obj = removePrototype(new SomeClass());
const obj2 = removePrototype(new SomeClass2());
expect(isSameType(obj, obj2)).toBeFalsy();
})
})
});
});
});

0 comments on commit dac66ec

Please sign in to comment.