Skip to content

Commit

Permalink
Chore(deps): replace deprecated faker api calls
Browse files Browse the repository at this point in the history
  • Loading branch information
emielvanseveren committed Aug 24, 2024
1 parent 4de7946 commit f0db656
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export async function getMockPlayer(extra: Partial<IGamePlayer> = {}): Promise<I
const data: Partial<IGamePlayer> = {
gameId: '1',
name: 'mock-player',
steamId: faker.random.alphaNumeric(17),
steamId: faker.string.alphanumeric(17),
...extra,
};

Expand Down
20 changes: 10 additions & 10 deletions packages/app-mock-gameserver/src/lib/gameserver/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,12 @@ export class MockGameserver implements IMockGameServer {
const players = Array.from(Array(5).keys()).map((p) => ({
gameId: p.toString(),
name: faker.internet.userName(),
epicOnlineServicesId: faker.random.alphaNumeric(16),
steamId: faker.random.alphaNumeric(16),
xboxLiveId: faker.random.alphaNumeric(16),
positionX: 500 - parseInt(faker.random.numeric(3), 10),
positionY: 500 - parseInt(faker.random.numeric(3), 10),
positionZ: 500 - parseInt(faker.random.numeric(3), 10),
epicOnlineServicesId: faker.string.alphanumeric(16),
steamId: faker.string.alphanumeric(16),
xboxLiveId: faker.string.alphanumeric(16),
positionX: 500 - faker.number.int({ max: 999 }),
positionY: 500 - faker.number.int({ max: 999 }),
positionZ: 500 - faker.number.int({ max: 999 }),
online: 'true',
}));

Expand All @@ -116,7 +116,7 @@ export class MockGameserver implements IMockGameServer {
name: player.name,
ip: player.ip,
steamId: player.steamId,
ping: parseInt(faker.random.numeric(2), 10),
ping: faker.number.int({ max: 99 }),
});
}

Expand All @@ -138,7 +138,7 @@ export class MockGameserver implements IMockGameServer {
name: player.name,
ip: player.ip,
steamId: player.steamId,
ping: parseInt(faker.random.numeric(2), 10),
ping: faker.number.int({ max: 99 }),
}),
),
);
Expand Down Expand Up @@ -347,11 +347,11 @@ export class MockGameserver implements IMockGameServer {
return [
new IItemDTO({
code: 'wood',
amount: parseInt(faker.random.numeric(2), 10),
amount: faker.number.int({ max: 99 }),
}),
new IItemDTO({
code: 'stone',
amount: parseInt(faker.random.numeric(2), 10),
amount: faker.number.int({ max: 99 }),
}),
];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ interface PingData {
function generateData() {
const data: PingData[] = [];
for (let i = 0; i < 100; i++) {
const timestamp = faker.date.between('2021-01-01T00:00:00Z', '2021-01-31T23:59:59Z').toISOString();
const latency = faker.datatype.number({ min: 0, max: 70, precision: 1 });
const timestamp = faker.date.between({ from: '2021-01-01T00:00:00Z', to: '2021-01-31T23:59:59Z' }).toISOString();
const latency = faker.number.float({ min: 0, max: 70, precision: 1 });
data.push({ timestamp, latency });
}
data.sort((a, b) => new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime());
Expand Down
4 changes: 2 additions & 2 deletions packages/lib-components/src/helpers/makeData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ const range = (len: number) => {
const newPerson = () => {
const statusChance = Math.random();
return {
firstName: faker.name.firstName(),
lastName: faker.name.lastName(),
firstName: faker.person.firstName(),
lastName: faker.person.lastName(),
age: Math.floor(Math.random() * 30),
visits: Math.floor(Math.random() * 100),
progress: Math.floor(Math.random() * 100),
Expand Down

0 comments on commit f0db656

Please sign in to comment.