Fix camera shake tests
@@ -4,8 +4,7 @@ test("Should be able to shake camera for a second", () => {
const mockCameraShake = jest.fn();
compile(
{
- shouldShakeX: true,
- shouldShakeY: true,
+ shakeDirection: "diagonal",
time: 1
},
{
@@ -39,12 +38,39 @@ test("Should shake camera horizontally if directions not set", () => {
expect(mockCameraShake).toBeCalledWith(true, false, 60);
});
+test("Should shake camera horizontally if direction set to horizontal", () => {
+ const mockCameraShake = jest.fn();
+ compile(
+ {
+ shakeDirection: "horizontal",
+ time: 1
+ },
+ {
+ cameraShake: mockCameraShake
+ }
+ );
+ expect(mockCameraShake).toBeCalledWith(true, false, 60);
+});
+
+test("Should shake camera vertically if direction set to vertical", () => {
+ const mockCameraShake = jest.fn();
+ compile(
+ {
+ shakeDirection: "vertical",
+ time: 1
+ },
+ {
+ cameraShake: mockCameraShake
+ }
+ );
+ expect(mockCameraShake).toBeCalledWith(false, true, 60);
+});
+
test("Should be able to shake camera for one and a half seconds", () => {
const mockCameraShake = jest.fn();
compile(
{
- shouldShakeX: true,
- shouldShakeY: true,
+ shakeDirection: "diagonal",
time: 1.5
},
{
