Skip to content

Commit

Permalink
Added tests for delta files
Browse files Browse the repository at this point in the history
  • Loading branch information
Atharva-Kanherkar committed Apr 22, 2024
1 parent 463aaf2 commit a8e62e5
Show file tree
Hide file tree
Showing 5 changed files with 637 additions and 409 deletions.
12 changes: 5 additions & 7 deletions src/resolvers/Mutation/createNote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ import type {
InterfaceAppUserProfile,
InterfaceUser,
} from "../../models";
import { AgendaItemModel, AppUserProfile, User } from "../../models";
import { cacheAppUserProfile } from "../../services/AppUserProfileCache/cacheAppUserProfile";
import { AgendaItemModel, AppUserProfile, NoteModel, User } from "../../models";
import { findAppUserProfileCache } from "../../services/AppUserProfileCache/findAppUserProfileCache";
import { cacheUsers } from "../../services/UserCache/cacheUser";
import { findUserInCache } from "../../services/UserCache/findUserInCache";
Expand Down Expand Up @@ -41,7 +40,6 @@ export const createNote: MutationResolvers["createNote"] = async (
await cacheUsers([currentUser]);
}
}

if (!currentUser) {
throw new errors.NotFoundError(
requestContext.translate(USER_NOT_FOUND_ERROR.MESSAGE),
Expand All @@ -58,9 +56,9 @@ export const createNote: MutationResolvers["createNote"] = async (
currentAppUserProfile = await AppUserProfile.findOne({
userId: currentUser._id,
}).lean();
if (currentAppUserProfile !== null) {
await cacheAppUserProfile([currentAppUserProfile]);
}
// if (currentAppUserProfile !== null) {
// await cacheAppUserProfile([currentAppUserProfile]);
// }
}
if (!currentAppUserProfile) {
throw new errors.UnauthenticatedError(
Expand All @@ -83,7 +81,7 @@ export const createNote: MutationResolvers["createNote"] = async (
);
}

const createdNote = await AgendaItemModel.create({
const createdNote = await NoteModel.create({
...args.data,
createdBy: currentUser._id,
updatedBy: currentUser._id,
Expand Down
3 changes: 3 additions & 0 deletions tests/helpers/note.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import type { InterfaceNote } from "../../src/models/Note";

export type TestNoteType = InterfaceNote & Document;
Loading

0 comments on commit a8e62e5

Please sign in to comment.