From 94e7d98de6e3b6b10dae332f6e458388f7162df3 Mon Sep 17 00:00:00 2001 From: Hayden <64056131+hay-kot@users.noreply.github.com> Date: Wed, 15 Nov 2023 15:15:50 -0600 Subject: [PATCH] remove depreciated calls --- frontend/lib/api/__test__/factories/index.ts | 6 ++--- frontend/lib/api/__test__/user/group.test.ts | 4 ++-- frontend/lib/api/__test__/user/items.test.ts | 4 ++-- .../lib/api/__test__/user/notifier.test.ts | 10 ++++----- frontend/lib/api/__test__/user/stats.test.ts | 22 +++++++++---------- 5 files changed, 23 insertions(+), 23 deletions(-) diff --git a/frontend/lib/api/__test__/factories/index.ts b/frontend/lib/api/__test__/factories/index.ts index ff821f9..dd76489 100644 --- a/frontend/lib/api/__test__/factories/index.ts +++ b/frontend/lib/api/__test__/factories/index.ts @@ -15,7 +15,7 @@ function itemField(id = null): ItemField { type: "text", textValue: faker.lorem.sentence(), booleanValue: false, - numberValue: faker.datatype.number(), + numberValue: faker.number.int(), timeValue: "", }; } @@ -28,7 +28,7 @@ function user(): UserRegistration { return { email: faker.internet.email(), password: faker.internet.password(), - name: faker.name.firstName(), + name: faker.person.firstName(), token: "", }; } @@ -36,7 +36,7 @@ function user(): UserRegistration { function location(parentId: string | null = null): LocationCreate { return { parentId, - name: faker.address.city(), + name: faker.location.city(), description: faker.lorem.sentence(), }; } diff --git a/frontend/lib/api/__test__/user/group.test.ts b/frontend/lib/api/__test__/user/group.test.ts index 181cfd5..40eafce 100644 --- a/frontend/lib/api/__test__/user/group.test.ts +++ b/frontend/lib/api/__test__/user/group.test.ts @@ -8,7 +8,7 @@ describe("first time user workflow (register, login, join group)", () => { test("user should be able to update group", async () => { const { client } = await factories.client.singleUse(); - const name = faker.name.firstName(); + const name = faker.person.firstName(); const { response, data: group } = await client.group.update({ name, @@ -34,7 +34,7 @@ describe("first time user workflow (register, login, join group)", () => { for (const currency of currencies) { const { response, data: group } = await client.group.update({ - name: faker.name.firstName(), + name: faker.person.firstName(), currency: currency.code, }); diff --git a/frontend/lib/api/__test__/user/items.test.ts b/frontend/lib/api/__test__/user/items.test.ts index 304a54e..698bd3f 100644 --- a/frontend/lib/api/__test__/user/items.test.ts +++ b/frontend/lib/api/__test__/user/items.test.ts @@ -135,9 +135,9 @@ describe("user should be able to create an item and add an attachment", () => { const { response, data } = await api.items.maintenance.create(item.id, { name: faker.vehicle.model(), description: faker.lorem.paragraph(1), - completedDate: faker.date.past(1), + completedDate: faker.date.past(), scheduledDate: "null", - cost: faker.datatype.number(100).toString(), + cost: faker.number.int(100).toString(), }); expect(response.status).toBe(201); diff --git a/frontend/lib/api/__test__/user/notifier.test.ts b/frontend/lib/api/__test__/user/notifier.test.ts index ed8e2ca..5a44c97 100644 --- a/frontend/lib/api/__test__/user/notifier.test.ts +++ b/frontend/lib/api/__test__/user/notifier.test.ts @@ -8,8 +8,8 @@ describe("basic notifier workflows", () => { // Create Notifier const result = await client.notifiers.create({ - name: faker.name.firstName(), - url: "discord://" + faker.random.alphaNumeric(10), + name: faker.person.firstName(), + url: "discord://" + faker.string.alphanumeric(10), isActive: true, }); @@ -22,8 +22,8 @@ describe("basic notifier workflows", () => { // Update Notifier with new URL { const updateData = { - name: faker.name.firstName(), - url: "discord://" + faker.random.alphaNumeric(10), + name: faker.person.firstName(), + url: "discord://" + faker.string.alphanumeric(10), isActive: true, }; @@ -37,7 +37,7 @@ describe("basic notifier workflows", () => { // Update Notifier with empty URL { const updateData = { - name: faker.name.firstName(), + name: faker.person.firstName(), url: null, isActive: true, }; diff --git a/frontend/lib/api/__test__/user/stats.test.ts b/frontend/lib/api/__test__/user/stats.test.ts index a13a03d..40f8e98 100644 --- a/frontend/lib/api/__test__/user/stats.test.ts +++ b/frontend/lib/api/__test__/user/stats.test.ts @@ -40,8 +40,8 @@ function importFileGenerator(entries: number): ImportObj[] { const pick = (arr: string[]) => arr[Math.floor(Math.random() * arr.length)]; - const labels = faker.random.words(5).split(" ").join(";"); - const locations = faker.random.words(3).split(" "); + const labels = faker.word.words(5).split(" ").join(";"); + const locations = faker.word.words(3).split(" "); const half = Math.floor(entries / 2); @@ -53,21 +53,21 @@ function importFileGenerator(entries: number): ImportObj[] { [`HB.import_ref`]: faker.database.mongodbObjectId(), [`HB.location`]: pick(locations), [`HB.labels`]: labels, - [`HB.quantity`]: Number(faker.random.numeric(2)), - [`HB.name`]: faker.random.words(3), + [`HB.quantity`]: Number(faker.number.int(2)), + [`HB.name`]: faker.word.words(3), [`HB.description`]: "", [`HB.insured`]: faker.datatype.boolean(), - [`HB.serial_number`]: faker.random.alphaNumeric(5), - [`HB.model_number`]: faker.random.alphaNumeric(5), - [`HB.manufacturer`]: faker.random.alphaNumeric(5), + [`HB.serial_number`]: faker.string.alphanumeric(5), + [`HB.model_number`]: faker.string.alphanumeric(5), + [`HB.manufacturer`]: faker.string.alphanumeric(5), [`HB.notes`]: "", - [`HB.purchase_from`]: faker.name.fullName(), - [`HB.purchase_price`]: faker.datatype.number(100), + [`HB.purchase_from`]: faker.person.fullName(), + [`HB.purchase_price`]: faker.number.int(100), [`HB.purchase_time`]: faker.date.past().toDateString(), [`HB.lifetime_warranty`]: half > i, [`HB.warranty_details`]: "", - [`HB.sold_to`]: faker.name.fullName(), - [`HB.sold_price`]: faker.datatype.number(100), + [`HB.sold_to`]: faker.person.fullName(), + [`HB.sold_price`]: faker.number.int(100), [`HB.sold_time`]: formatDate(faker.date.past()), [`HB.sold_notes`]: "", });