Skip to content

Commit

Permalink
feat: implemented additional workers for server creation, added more …
Browse files Browse the repository at this point in the history
…mocks, added factions and reputations, added viewport context, code refactors
  • Loading branch information
Jure Rotar committed Nov 16, 2023
1 parent 519f8e8 commit 1a49602
Show file tree
Hide file tree
Showing 76 changed files with 1,581 additions and 13,017 deletions.
54 changes: 0 additions & 54 deletions __mocks__/game/map/predefined-villages-coordinates-100x100-mock.ts

This file was deleted.

54 changes: 0 additions & 54 deletions __mocks__/game/map/predefined-villages-coordinates-200x200-mock.ts

This file was deleted.

54 changes: 0 additions & 54 deletions __mocks__/game/map/predefined-villages-coordinates-400x400-mock.ts

This file was deleted.

112 changes: 112 additions & 0 deletions __mocks__/game/map/predefined-villages-coordinates-mock.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
export const predefinedVillagesCoordinates100x100Mock = {
artifactVillagesCoordinates: [
{
x: -17,
y: 40
},
{
x: 17,
y: 40
},
{
x: -17,
y: -40
},
{
x: 17,
y: -40
},
{
x: 40,
y: 17
},
{
x: 40,
y: -17
},
{
x: -40,
y: 17
},
{
x: -40,
y: -17
}
],
};

export const predefinedVillagesCoordinates200x200Mock = {
artifactVillagesCoordinates: [
{
x: -33,
y: 80
},
{
x: 33,
y: 80
},
{
x: -33,
y: -80
},
{
x: 33,
y: -80
},
{
x: 80,
y: 33
},
{
x: 80,
y: -33
},
{
x: -80,
y: 33
},
{
x: -80,
y: -33
}
],
};

export const predefinedVillagesCoordinates400x400Mock = {
artifactVillagesCoordinates: [
{
x: -66,
y: 160
},
{
x: 66,
y: 160
},
{
x: -66,
y: -160
},
{
x: 66,
y: -160
},
{
x: 160,
y: 66
},
{
x: 160,
y: -66
},
{
x: -160,
y: 66
},
{
x: -160,
y: -66
}
],
};


4 changes: 4 additions & 0 deletions __mocks__/game/village/building-fields-mock.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { BuildingField } from 'interfaces/models/game/village';
import { villagePresets } from 'assets/village-presets';

export const newVillageBuildingFieldsMock: BuildingField[] = villagePresets.find(({ preset }) => preset === 'new-village')!.buildingFields;
41 changes: 41 additions & 0 deletions __mocks__/models/game/player-mock.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { Player } from 'interfaces/models/game/player';

export const playerMock: Player = {
"id": "42c53448-ab04-4ae3-8ce5-dccad55162a7",
"serverId": "80d4669b-4222-41cd-a0c0-7c95dcaf2f59",
"faction": "player"
};

export const npcPlayerMock: Player = {
"id": "524228a8-8610-43cf-807b-af241f18ba13",
"serverId": "80d4669b-4222-41cd-a0c0-7c95dcaf2f59",
"faction": "npc3"
};

export const playersMock: Player[] = [
{
"id": "42c53448-ab04-4ae3-8ce5-dccad55162a7",
"serverId": "80d4669b-4222-41cd-a0c0-7c95dcaf2f59",
"faction": "player"
},
{
"id": "524228a8-8610-43cf-807b-af241f18ba13",
"serverId": "80d4669b-4222-41cd-a0c0-7c95dcaf2f59",
"faction": "npc3"
},
{
"id": "b2949612-7e4f-4695-8cb4-0f0b636a2d3e",
"serverId": "80d4669b-4222-41cd-a0c0-7c95dcaf2f59",
"faction": "npc2"
},
{
"id": "c6be0a22-d6d2-4b79-a837-e844a4a865f3",
"serverId": "80d4669b-4222-41cd-a0c0-7c95dcaf2f59",
"faction": "npc4"
},
{
"id": "dfacafb5-e241-4d4d-b673-ff56f6bcf03b",
"serverId": "80d4669b-4222-41cd-a0c0-7c95dcaf2f59",
"faction": "npc1"
}
]
5 changes: 5 additions & 0 deletions jest-setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Object.defineProperty(globalThis, 'crypto', {
value: {
randomUUID: () => 'uuid'
}
});
4 changes: 2 additions & 2 deletions jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export default {
// runner: "jest-runner",

// The paths to modules that run some code to configure or set up the testing environment before each test
// setupFiles: [],
setupFiles: ['<rootDir>/jest-setup.ts'],

// A list of paths to modules that run some code to configure or set up the testing framework before each test
// setupFilesAfterEnv: [],
Expand Down Expand Up @@ -191,7 +191,7 @@ export default {
// unmockedModulePathPatterns: undefined,

// Indicates whether each individual test should be reported during the run
verbose: true
verbose: false

// An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
// watchPathIgnorePatterns: [],
Expand Down
7 changes: 6 additions & 1 deletion src/app/(game)/error-boundary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@ import { useRouteError } from 'react-router-dom';

export const GameErrorBoundary = () => {
const error = useRouteError();
const { name, message } = error as Error;

return (
<p>Error... </p>
<>
<h1>{name}</h1>
<p>{message}</p>
</>
);
};
Loading

0 comments on commit 1a49602

Please sign in to comment.