Skip to content

Commit

Permalink
variable name fix
Browse files Browse the repository at this point in the history
  • Loading branch information
meetulr committed Oct 28, 2024
1 parent 21069ab commit fdbffa3
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 29 deletions.
22 changes: 11 additions & 11 deletions tests/resolvers/Mutation/assignToUserTags.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,18 +192,18 @@ describe("resolvers -> Mutation -> assignToUserTags", () => {

expect(payload?._id.toString()).toEqual(testTag2?._id.toString());

const tagAssignedToRandomUser1 = await TagUser.exists({
const tagAssignedToRandomUser2 = await TagUser.exists({
tagId: testTag3,
userId: randomUser2?._id,
});

const tagAssignedToRandomUser2 = await TagUser.exists({
const tagAssignedToRandomUser3 = await TagUser.exists({
tagId: testTag3,
userId: randomUser3?._id,
});

expect(tagAssignedToRandomUser1).toBeTruthy();
expect(tagAssignedToRandomUser2).toBeTruthy();
expect(tagAssignedToRandomUser3).toBeTruthy();
});

it(`Should assign all the ancestor tags and returns the current tag`, async () => {
Expand Down Expand Up @@ -260,31 +260,31 @@ describe("resolvers -> Mutation -> assignToUserTags", () => {

expect(payload?._id.toString()).toEqual(newTestTag?._id.toString());

const subTagAssignedToRandomUser1 = await TagUser.exists({
const subTagAssignedToRandomUser2 = await TagUser.exists({
tagId: testSubTag1?._id,
userId: randomUser2?._id,
});

const subTagAssignedToRandomUser2 = await TagUser.exists({
const subTagAssignedToRandomUser3 = await TagUser.exists({
tagId: testSubTag1?._id,
userId: randomUser3?._id,
});

expect(subTagAssignedToRandomUser1).toBeTruthy();
expect(subTagAssignedToRandomUser2).toBeTruthy();
expect(subTagAssignedToRandomUser3).toBeTruthy();

const ancestorTagAssignedToRandomUser1 = await TagUser.exists({
const ancestorTagAssignedToRandomUser2 = await TagUser.exists({
tagId: testTag?._id.toString() ?? "",
userId: randomUser2?._id,
});

const ancestorTagAssignedToRandomUser2 = await TagUser.exists({
const ancestorTagAssignedToRandomUser3 = await TagUser.exists({
tagId: testTag?._id.toString() ?? "",
userId: randomUser3?._id,
});

expect(ancestorTagAssignedToRandomUser1).toBeTruthy();
expect(ancestorTagAssignedToRandomUser2).toBeTruthy();
expect(ancestorTagAssignedToRandomUser3).toBeTruthy();
});
});

Expand All @@ -302,10 +302,10 @@ const testErrorScenario = async ({
.spyOn(requestContext, "translate")
.mockImplementationOnce((message) => `Translated ${message}`);
try {
const { assignToUserTags: assignToUserTags } = await import(
const { assignToUserTags: assignToUserTagsResolver } = await import(
"../../../src/resolvers/Mutation/assignToUserTags"
);
await assignToUserTags?.({}, args, context);
await assignToUserTagsResolver?.({}, args, context);
throw new Error("Expected error was not thrown");
} catch (error: unknown) {
if (error instanceof Error) {
Expand Down
36 changes: 18 additions & 18 deletions tests/resolvers/Mutation/removeFromUserTags.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,18 +201,18 @@ describe("resolvers -> Mutation -> removeFromUserTags", () => {
testTag2?._id.toString(),
);

const tagAssignedToRandomUser1 = await TagUser.exists({
const tagAssignedToRandomUser2 = await TagUser.exists({
tagId: testTag3,
userId: randomUser2?._id,
});

const tagAssignedToRandomUser2 = await TagUser.exists({
const tagAssignedToRandomUser3 = await TagUser.exists({
tagId: testTag3,
userId: randomUser3?._id,
});

expect(tagAssignedToRandomUser1).toBeTruthy();
expect(tagAssignedToRandomUser2).toBeTruthy();
expect(tagAssignedToRandomUser3).toBeTruthy();

// now remove them from that tag with the help of removeFromUserTags mutation
const args: MutationRemoveFromUserTagsArgs = {
Expand All @@ -234,18 +234,18 @@ describe("resolvers -> Mutation -> removeFromUserTags", () => {

expect(payload?._id.toString()).toEqual(testTag2?._id.toString());

const tagExistsForRandomUser1 = await TagUser.exists({
const tagExistsForRandomUser2 = await TagUser.exists({
tagId: testTag3,
userId: randomUser2?._id,
});

const tagExistsForRandomUser2 = await TagUser.exists({
const tagExistsForRandomUser3 = await TagUser.exists({
tagId: testTag3,
userId: randomUser3?._id,
});

expect(tagExistsForRandomUser1).toBeFalsy();
expect(tagExistsForRandomUser2).toBeFalsy();
expect(tagExistsForRandomUser3).toBeFalsy();
});

it(`Should remove all the decendent tags too and returns the current tag`, async () => {
Expand Down Expand Up @@ -308,31 +308,31 @@ describe("resolvers -> Mutation -> removeFromUserTags", () => {
newTestTag?._id.toString(),
);

const subTagAssignedToRandomUser1 = await TagUser.exists({
const subTagAssignedToRandomUser2 = await TagUser.exists({
tagId: testSubTag1?._id,
userId: randomUser2?._id,
});

const subTagAssignedToRandomUser2 = await TagUser.exists({
const subTagAssignedToRandomUser3 = await TagUser.exists({
tagId: testSubTag1?._id,
userId: randomUser3?._id,
});

expect(subTagAssignedToRandomUser1).toBeTruthy();
expect(subTagAssignedToRandomUser2).toBeTruthy();
expect(subTagAssignedToRandomUser3).toBeTruthy();

const ancestorTagAssignedToRandomUser1 = await TagUser.exists({
const ancestorTagAssignedToRandomUser2 = await TagUser.exists({
tagId: testTag?._id.toString() ?? "",
userId: randomUser2?._id,
});

const ancestorTagAssignedToRandomUser2 = await TagUser.exists({
const ancestorTagAssignedToRandomUser3 = await TagUser.exists({
tagId: testTag?._id.toString() ?? "",
userId: randomUser3?._id,
});

expect(ancestorTagAssignedToRandomUser1).toBeTruthy();
expect(ancestorTagAssignedToRandomUser2).toBeTruthy();
expect(ancestorTagAssignedToRandomUser3).toBeTruthy();

// now remove the parent tag, which will also remove the subtags
const args: MutationRemoveFromUserTagsArgs = {
Expand All @@ -353,31 +353,31 @@ describe("resolvers -> Mutation -> removeFromUserTags", () => {

expect(payload?._id.toString()).toEqual(newTestTag?._id.toString());

const subTagExistsForRandomUser1 = await TagUser.exists({
const subTagExistsForRandomUser2 = await TagUser.exists({
tagId: testSubTag1?._id,
userId: randomUser2?._id,
});

const subTagExistsForRandomUser2 = await TagUser.exists({
const subTagExistsForRandomUser3 = await TagUser.exists({
tagId: testSubTag1?._id,
userId: randomUser3?._id,
});

expect(subTagExistsForRandomUser1).toBeFalsy();
expect(subTagExistsForRandomUser2).toBeFalsy();
expect(subTagExistsForRandomUser3).toBeFalsy();

const ancestorTagExistsForRandomUser1 = await TagUser.exists({
const ancestorTagExistsForRandomUser2 = await TagUser.exists({
tagId: testTag?._id.toString() ?? "",
userId: randomUser2?._id,
});

const ancestorTagExistsForRandomUser2 = await TagUser.exists({
const ancestorTagExistsForRandomUser3 = await TagUser.exists({
tagId: testTag?._id.toString() ?? "",
userId: randomUser3?._id,
});

expect(ancestorTagExistsForRandomUser1).toBeFalsy();
expect(ancestorTagExistsForRandomUser2).toBeFalsy();
expect(ancestorTagExistsForRandomUser3).toBeFalsy();
});
});

Expand Down

0 comments on commit fdbffa3

Please sign in to comment.