Skip to content

Commit

Permalink
Update tests. Update dependencies.
Browse files Browse the repository at this point in the history
  • Loading branch information
Neloreck committed Apr 12, 2024
1 parent 58e2537 commit 8aa746a
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 30 deletions.
34 changes: 17 additions & 17 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
"eslint-config-standard-with-typescript": "^43.0.1",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jest": "^27.9.0",
"eslint-plugin-jsdoc": "^48.2.1",
"eslint-plugin-react": "^7.34.0",
"eslint-plugin-jsdoc": "^48.2.3",
"eslint-plugin-react": "^7.34.1",
"eslint-plugin-sort-keys-fix": "^1.1.2",
"eslint-plugin-unused-imports": "^3.1.0",
"fast-xml-parser": "^4.3.5",
Expand All @@ -55,8 +55,8 @@
"ts-jest": "^29.1.2",
"ts-node": "^10.9.2",
"tsconfig-paths": "^4.2.0",
"typescript": "^5.3.3",
"typescript-to-lua": "^1.24.1"
"typescript": "^5.4.2",
"typescript-to-lua": "^1.25.1"
},
"bin": {
"xrf": "./cli/run.ts"
Expand Down
44 changes: 39 additions & 5 deletions src/engine/scripts/declarations/effects/object.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { beforeAll, beforeEach, describe, expect, it } from "@jest/globals";
import { beforeAll, beforeEach, describe, expect, it, jest } from "@jest/globals";

import { registerStoryLink } from "@/engine/core/database";
import { misc } from "@/engine/lib/constants/items/misc";
Expand Down Expand Up @@ -126,9 +126,27 @@ describe("object effects implementation", () => {

it.todo("force_obj should set const force for objects");

it.todo("burer_force_gravi_attack should force burrer attack");
it("burer_force_gravi_attack should force burrer attack", () => {
const object: GameObject = MockGameObject.mock();

jest.spyOn(object, "burer_set_force_gravi_attack").mockImplementation(jest.fn());

callXrEffect("burer_force_gravi_attack", MockGameObject.mockActor(), object);

expect(object.burer_set_force_gravi_attack).toHaveBeenCalledTimes(1);
expect(object.burer_set_force_gravi_attack).toHaveBeenCalledWith(true);
});

it.todo("burer_force_anti_aim should force attack reset");
it("burer_force_anti_aim should force attack reset", () => {
const object: GameObject = MockGameObject.mock();

jest.spyOn(object, "set_force_anti_aim").mockImplementation(jest.fn());

callXrEffect("burer_force_anti_aim", MockGameObject.mockActor(), object);

expect(object.set_force_anti_aim).toHaveBeenCalledTimes(1);
expect(object.set_force_anti_aim).toHaveBeenCalledWith(true);
});

it.todo("give_items should give items for object");

Expand All @@ -138,13 +156,29 @@ describe("object effects implementation", () => {

it.todo("set_force_sleep_animation should force sleep animation");

it.todo("release_force_sleep_animation should stop forced sleep animation");
it("release_force_sleep_animation should stop forced sleep animation", () => {
const object: GameObject = MockGameObject.mock();

jest.spyOn(object, "release_stand_sleep_animation").mockImplementation(jest.fn());

callXrEffect("release_force_sleep_animation", MockGameObject.mockActor(), object);

expect(object.release_stand_sleep_animation).toHaveBeenCalledTimes(1);
});

it.todo("set_visual_memory_enabled should enable visual memory");

it.todo("set_monster_animation should set animations for monsters");

it.todo("clear_monster_animation should clear animations for monsters");
it("clear_monster_animation should clear animations for monsters", () => {
const object: GameObject = MockGameObject.mock();

jest.spyOn(object, "clear_override_animation").mockImplementation(jest.fn());

callXrEffect("clear_monster_animation", MockGameObject.mockActor(), object);

expect(object.clear_override_animation).toHaveBeenCalledTimes(1);
});

it.todo("switch_to_desired_job should switch objects to desired jobs");

Expand Down
8 changes: 4 additions & 4 deletions src/engine/scripts/declarations/effects/object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -638,14 +638,14 @@ extern(
);

/**
* todo;
* Force burer gravity attack as enabled.
*/
extern("xr_effects.burer_force_gravi_attack", (_: GameObject, object: GameObject): void => {
object.burer_set_force_gravi_attack(true);
});

/**
* todo;
* Force burer anti aim force.
*/
extern("xr_effects.burer_force_anti_aim", (_: GameObject, object: GameObject): void => {
object.set_force_anti_aim(true);
Expand Down Expand Up @@ -699,7 +699,7 @@ extern("xr_effects.set_force_sleep_animation", (_: GameObject, object: GameObjec
});

/**
* todo;
* Release sleep animation of the object.
*/
extern("xr_effects.release_force_sleep_animation", (_: GameObject, object: GameObject): void => {
object.release_stand_sleep_animation();
Expand Down Expand Up @@ -729,7 +729,7 @@ extern(
);

/**
* todo;
* Clear animation of monster object.
*/
extern("xr_effects.clear_monster_animation", (_: GameObject, object: GameObject): void => {
object.clear_override_animation();
Expand Down
8 changes: 8 additions & 0 deletions src/fixtures/xray/mocks/objects/game/game_object.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,10 @@ export class MockGameObject {

public bind_object = jest.fn();

public burer_set_force_gravi_attack = jest.fn();

public set_force_anti_aim = jest.fn();

public buy_condition = jest.fn();

public buy_supplies = jest.fn();
Expand All @@ -239,6 +243,8 @@ export class MockGameObject {

public center = jest.fn(() => this.objectCenter);

public clear_override_animation = jest.fn();

public change_team = jest.fn();

public change_character_reputation = jest.fn();
Expand Down Expand Up @@ -487,6 +493,8 @@ export class MockGameObject {

public play_cycle = jest.fn();

public release_stand_sleep_animation = jest.fn();

public rank = jest.fn(() => this.objectRank);

public relation = jest.fn(() => {
Expand Down

0 comments on commit 8aa746a

Please sign in to comment.