Skip to content

Commit

Permalink
Merge pull request #71 from jamalsoueidan/update-npm-packages
Browse files Browse the repository at this point in the history
chore(package.json): update dependencies versions
  • Loading branch information
jamalsoueidan authored Oct 12, 2023
2 parents ae33618 + ba435bf commit 53e70c8
Show file tree
Hide file tree
Showing 16 changed files with 5,847 additions and 5,640 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,3 @@ let responseJson = pm.response.json();
let token = responseJson.payload.token;
pm.environment.set("bearerToken", token);
```

.
11,327 changes: 5,768 additions & 5,559 deletions package-lock.json

Large diffs are not rendered by default.

38 changes: 19 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,31 +17,31 @@
"generate-ts": "npm run bundle && npx orval --config ./orval.config.js"
},
"dependencies": {
"@azure/functions": "^4.0.0-alpha.9",
"@types/jsonwebtoken": "^9.0.1",
"axios": "^1.4.0",
"@azure/functions": "^4.0.1",
"@types/jsonwebtoken": "^9.0.3",
"axios": "^1.5.1",
"bcryptjs": "^2.4.3",
"date-fns": "^2.29.3",
"durable-functions": "^3.0.0-alpha.4",
"date-fns": "^2.30.0",
"durable-functions": "^3.0.0",
"generate-password": "^1.7.0",
"graphql-request": "^5.2.0",
"jsonwebtoken": "^9.0.0",
"module-alias": "^2.2.2",
"mongoose": "^7.3.1",
"zod": "^3.21.4"
"graphql-request": "^6.1.0",
"jsonwebtoken": "^9.0.2",
"module-alias": "^2.2.3",
"mongoose": "^7.6.1",
"zod": "^3.22.4"
},
"devDependencies": {
"@faker-js/faker": "^7.6.0",
"@types/bcryptjs": "^2.4.2",
"@types/jest": "^29.5.0",
"@types/node": "^18.x",
"@faker-js/faker": "^8.1.0",
"@types/bcryptjs": "^2.4.4",
"@types/jest": "^29.5.5",
"@types/node": "^20.x",
"date-fns-tz": "^2.0.0",
"fs": "^0.0.1-security",
"jest": "^29.5.0",
"mongodb-memory-server": "^8.12.1",
"orval": "^6.16.0",
"ts-jest": "^29.0.5",
"typescript": "^4.0.0"
"jest": "^29.7.0",
"mongodb-memory-server": "^9.0.0",
"orval": "^6.18.1",
"ts-jest": "^29.1.1",
"typescript": "^5.2.2"
},
"main": "dist/src/functions/*.js"
}
4 changes: 2 additions & 2 deletions src/functions/customer/controllers/customer/update.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ describe("CustomerControllerUpdate", () => {
let context: InvocationContext;
let request: HttpRequest;

const query = { customerId: faker.datatype.number() };
const query = { customerId: faker.number.int() };
const body: CustomerControllerUpdateBody = {
yearsExperience: 1,
fullname: "test",
username: faker.internet.userName(),
aboutMe: faker.lorem.paragraph(),
speaks: [faker.random.locale()],
speaks: [faker.location.countryCode()],
images: {
profile: {
url: faker.internet.avatar(),
Expand Down
4 changes: 2 additions & 2 deletions src/functions/customer/controllers/customer/upsert.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ describe("CustomerControllerUpsert", () => {
let context: InvocationContext;
let request: HttpRequest;

const query = { customerId: faker.datatype.number() };
const query = { customerId: faker.number.int() };
const body: CustomerControllerUpsertBody = {
yearsExperience: 1,
username: faker.internet.userName(),
aboutMe: faker.lorem.paragraph(),
speaks: [faker.random.locale()],
speaks: [faker.location.countryCode()],
images: {
profile: {
url: faker.internet.avatar(),
Expand Down
16 changes: 8 additions & 8 deletions src/functions/customer/services/availability.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@ jest.mock("~/functions/lookup", () => {
LookupServiceCreate: jest.fn().mockResolvedValueOnce({
_id: new mongoose.Types.ObjectId(),
origin: {
name: faker.name.firstName(),
customerId: faker.datatype.number({ min: 1, max: 100000 }),
fullAddress: faker.address.streetAddress(),
distanceHourlyRate: faker.datatype.number({ min: 1, max: 5 }),
fixedRatePerKm: faker.datatype.number({ min: 1, max: 5 }),
minDistanceForFree: faker.datatype.number({ min: 1, max: 5 }),
name: faker.person.firstName(),
customerId: faker.number.int({ min: 1, max: 100000 }),
fullAddress: faker.location.streetAddress(),
distanceHourlyRate: faker.number.int({ min: 1, max: 5 }),
fixedRatePerKm: faker.number.int({ min: 1, max: 5 }),
minDistanceForFree: faker.number.int({ min: 1, max: 5 }),
},
destination: {
name: faker.name.firstName(),
fullAddress: faker.address.streetAddress(),
name: faker.person.firstName(),
fullAddress: faker.location.streetAddress(),
},
duration: {
text: "14 mins",
Expand Down
14 changes: 7 additions & 7 deletions src/functions/customer/services/customer.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require("~/library/jest/mongoose/mongodb.jest");
describe("CustomerService", () => {
const userData: CustomerServiceUpsertBody = {
username: faker.internet.userName(),
fullname: faker.name.fullName(),
fullname: faker.person.fullName(),
social: {
instagram: faker.internet.url(),
youtube: faker.internet.url(),
Expand All @@ -25,13 +25,13 @@ describe("CustomerService", () => {
},
},
locations: [],
speaks: [faker.random.locale()],
speaks: [faker.location.countryCode()],
isBusiness: true,
};

it("Should create a user", async () => {
const newUser = await CustomerServiceUpsert(
{ customerId: faker.datatype.number() },
{ customerId: faker.number.int() },
userData
);

Expand All @@ -40,7 +40,7 @@ describe("CustomerService", () => {

it("Should get the customer by customerId", async () => {
const newUser = await CustomerServiceUpsert(
{ customerId: faker.datatype.number() },
{ customerId: faker.number.int() },
userData
);

Expand All @@ -53,7 +53,7 @@ describe("CustomerService", () => {

it("Should check if customer exist", async () => {
const newUser = await CustomerServiceUpsert(
{ customerId: faker.datatype.number() },
{ customerId: faker.number.int() },
userData
);

Expand All @@ -64,14 +64,14 @@ describe("CustomerService", () => {
});

it("Should update a user by customerId", async () => {
const filter = { customerId: faker.datatype.number() };
const filter = { customerId: faker.number.int() };
// Create a user first
await CustomerServiceUpsert(filter, userData);

// Update the user
const updatedData: CustomerServiceUpsertBody = {
...userData,
fullname: faker.name.fullName(),
fullname: faker.person.fullName(),
};

const updatedUser = await CustomerServiceUpsert(filter, updatedData);
Expand Down
2 changes: 1 addition & 1 deletion src/functions/customer/services/location.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
require("~/library/jest/mongoose/mongodb.jest");

describe("CustomerLocationService", () => {
const customerId = faker.datatype.number();
const customerId = faker.number.int();

const location1: Location = {
name: "Falafel 1",
Expand Down
12 changes: 6 additions & 6 deletions src/functions/lookup/lookup.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ jest.mock("~/functions/location/services", () => {
LocationServiceLookup: jest.fn().mockResolvedValueOnce({
location: {
_id: new mongoose.Types.ObjectId(),
name: faker.name.firstName(),
customerId: faker.datatype.number({ min: 1, max: 100000 }),
fullAddress: faker.address.streetAddress(),
distanceHourlyRate: faker.datatype.number({ min: 1, max: 5 }),
fixedRatePerKm: faker.datatype.number({ min: 1, max: 5 }),
minDistanceForFree: faker.datatype.number({ min: 1, max: 5 }),
name: faker.person.firstName(),
customerId: faker.number.int({ min: 1, max: 100000 }),
fullAddress: faker.location.streetAddress(),
distanceHourlyRate: faker.number.int({ min: 1, max: 5 }),
fixedRatePerKm: faker.number.int({ min: 1, max: 5 }),
minDistanceForFree: faker.number.int({ min: 1, max: 5 }),
},
travelTime: {
duration: { text: "14 mins", value: 831 },
Expand Down
20 changes: 10 additions & 10 deletions src/functions/shipping/shipping.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ describe("ShippingService", () => {
it("should correctly calculate the cost", () => {
const lookup = {
origin: {
name: faker.name.firstName(),
customerId: faker.datatype.number({ min: 1, max: 100000 }),
fullAddress: faker.address.streetAddress(),
name: faker.person.firstName(),
customerId: faker.number.int({ min: 1, max: 100000 }),
fullAddress: faker.location.streetAddress(),
distanceHourlyRate: 100,
fixedRatePerKm: 20,
minDistanceForFree: 5,
},
destination: {
name: faker.name.firstName(),
fullAddress: faker.address.streetAddress(),
name: faker.person.firstName(),
fullAddress: faker.location.streetAddress(),
},
duration: {
text: "1 hour",
Expand All @@ -44,16 +44,16 @@ describe("ShippingService", () => {
it("should calculate destination in available slots", async () => {
const lookup = await LookupModel.create({
origin: {
name: faker.name.firstName(),
customerId: faker.datatype.number({ min: 1, max: 100000 }),
fullAddress: faker.address.streetAddress(),
name: faker.person.firstName(),
customerId: faker.number.int({ min: 1, max: 100000 }),
fullAddress: faker.location.streetAddress(),
distanceHourlyRate: 100,
fixedRatePerKm: 20,
minDistanceForFree: 5,
},
destination: {
name: faker.name.firstName(),
fullAddress: faker.address.streetAddress(),
name: faker.person.firstName(),
fullAddress: faker.location.streetAddress(),
},
duration: {
text: "1 hour",
Expand Down
10 changes: 5 additions & 5 deletions src/functions/user/services/schedule.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe("UserScheduleService", () => {
});

const schedule1 = await CustomerScheduleServiceCreate({
name: faker.name.firstName(),
name: faker.person.firstName(),
customerId,
products: [
getProductObject({
Expand All @@ -52,7 +52,7 @@ describe("UserScheduleService", () => {
});

const schedule2 = await CustomerScheduleServiceCreate({
name: faker.name.firstName(),
name: faker.person.firstName(),
customerId,
products: [
getProductObject({
Expand All @@ -75,7 +75,7 @@ describe("UserScheduleService", () => {
});

await CustomerScheduleServiceCreate({
name: faker.name.firstName(),
name: faker.person.firstName(),
customerId,
products: [],
});
Expand All @@ -102,7 +102,7 @@ describe("UserScheduleService", () => {

it("should return none schedules when schedule does not contain any products", async () => {
await CustomerScheduleServiceCreate({
name: faker.name.firstName(),
name: faker.person.firstName(),
customerId,
products: [],
});
Expand All @@ -122,7 +122,7 @@ describe("UserScheduleService", () => {
});

const schedule = await CustomerScheduleServiceCreate({
name: faker.name.firstName(),
name: faker.person.firstName(),
customerId,
products: [
getProductObject({
Expand Down
8 changes: 4 additions & 4 deletions src/functions/user/services/user.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ require("~/library/jest/mongoose/mongodb.jest");
describe("UserService", () => {
it("Should find user", async () => {
// Create multiple users
const filter = { customerId: faker.datatype.number() };
const filter = { customerId: faker.number.int() };
const username = faker.internet.userName();
// Create a user first
const userData: CustomerServiceUpsertBody = {
yearsExperience: 1,
professions: [Professions.MAKEUP_ARTIST],
username,
fullname: faker.name.fullName(),
fullname: faker.person.fullName(),
shortDescription: faker.lorem.paragraph(),
aboutMe: faker.lorem.paragraph(),
speaks: [faker.random.locale()],
speaks: [faker.location.countryCode()],
active: true,
isBusiness: true,
locations: [],
Expand Down Expand Up @@ -79,7 +79,7 @@ describe("UserService", () => {
it("Should get group and count professions by all users", async () => {
const professions = Object.values(Professions);

const professionCount = faker.datatype.number({
const professionCount = faker.number.int({
min: 1,
max: professions.length,
});
Expand Down
16 changes: 8 additions & 8 deletions src/library/jest/helpers/location.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ import { User } from "~/functions/user";
export const DEFAULT_GROUP = "all";

export const getLocationObject = (props: Partial<Location> = {}): Location => ({
name: faker.name.firstName(),
customerId: faker.datatype.number({ min: 1, max: 100000 }),
name: faker.person.firstName(),
customerId: faker.number.int({ min: 1, max: 100000 }),
locationType: LocationTypes.ORIGIN,
originType: LocationOriginTypes.COMMERCIAL,
fullAddress: faker.address.streetAddress(),
distanceHourlyRate: faker.datatype.number({ min: 1, max: 5 }),
fixedRatePerKm: faker.datatype.number({ min: 1, max: 5 }),
minDistanceForFree: faker.datatype.number({ min: 1, max: 5 }),
fullAddress: faker.location.streetAddress(),
distanceHourlyRate: faker.number.int({ min: 1, max: 5 }),
fixedRatePerKm: faker.number.int({ min: 1, max: 5 }),
minDistanceForFree: faker.number.int({ min: 1, max: 5 }),
...props,
});

Expand All @@ -27,8 +27,8 @@ export const createLocation = (
const location = new LocationModel(getLocationObject(filter));
location.geoLocation.type = "Point";
location.geoLocation.coordinates = [
parseFloat(faker.address.latitude()),
parseFloat(faker.address.longitude()),
faker.location.latitude(),
faker.location.longitude(),
];
location.handle = faker.internet.userName();
return location.save();
Expand Down
4 changes: 2 additions & 2 deletions src/library/jest/helpers/product.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { ScheduleProduct, TimeUnit } from "~/functions/schedule";
export const getProductObject = (
props: Partial<ScheduleProduct> = {}
): ScheduleProduct => ({
productId: faker.datatype.number({ min: 1, max: 10000000 }),
variantId: faker.datatype.number({ min: 1, max: 10000000 }),
productId: faker.number.int({ min: 1, max: 10000000 }),
variantId: faker.number.int({ min: 1, max: 10000000 }),
duration: faker.helpers.arrayElement([30, 45, 60]),
breakTime: faker.helpers.arrayElement([5, 10, 15]),
bookingPeriod: {
Expand Down
4 changes: 2 additions & 2 deletions src/library/jest/helpers/schedule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ export const getScheduleObject = (
}));

return {
name: faker.random.word(),
customerId: faker.datatype.number(),
name: faker.word.sample(),
customerId: faker.number.int(),
slots,
products,
...props,
Expand Down
6 changes: 3 additions & 3 deletions src/library/jest/helpers/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { User } from "~/functions/user";
export const DEFAULT_GROUP = "all";

export const getUserObject = (props: Partial<User> = {}) => ({
title: faker.name.jobTitle(),
title: faker.person.jobTitle(),
username: faker.internet.userName().toLowerCase(),
fullname: faker.name.fullName(),
fullname: faker.person.fullName(),
social: {
instagram: faker.internet.url(),
youtube: faker.internet.url(),
Expand All @@ -17,7 +17,7 @@ export const getUserObject = (props: Partial<User> = {}) => ({
active: true,
isBusiness: true,
avatar: faker.internet.avatar(),
speaks: [faker.random.locale()],
speaks: [faker.location.countryCode()],
locations: [],
...props,
});
Expand Down

0 comments on commit 53e70c8

Please sign in to comment.