diff --git a/__tests__/pages/admin/lessons/[lessonSlug]/[pageName]/lessons.test.js b/__tests__/pages/admin/lessons/[lessonSlug]/[pageName]/lessons.test.js
index 7df69e0ff..ee3929408 100644
--- a/__tests__/pages/admin/lessons/[lessonSlug]/[pageName]/lessons.test.js
+++ b/__tests__/pages/admin/lessons/[lessonSlug]/[pageName]/lessons.test.js
@@ -15,7 +15,7 @@ import { CHALLENGES } from '../../../../../../graphql/queries/challenges'
import ADD_CHALLENGE from '../../../../../../graphql/queries/createChallenge'
import GET_EXERCISES from '../../../../../../graphql/queries/getExercises'
import REMOVE_EXERCISE_FLAG from '../../../../../../graphql/queries/removeExerciseFlag'
-import DELETE_EXERCISE from '../../../../../../graphql/queries/deleteExercise'
+import REMOVE_EXERCISE from '../../../../../../graphql/queries/removeExercise'
import { MockedProvider } from '@apollo/client/testing'
import userEvent from '@testing-library/user-event'
import UPDATE_LESSON from '../../../../../../graphql/queries/updateLesson'
@@ -194,14 +194,14 @@ const getExerciseWithRefetchMock = {
}
}
-const deleteExerciseMock = {
+const removeExerciseMock = {
request: {
- query: DELETE_EXERCISE,
+ query: REMOVE_EXERCISE,
variables: { id: 1 }
},
result: {
data: {
- deleteExercise: {
+ removeExercise: {
id: 1
}
}
@@ -280,7 +280,7 @@ const mocksWithRefetchExercises = [
getAppQueryMock,
getAppQueryMock,
getExerciseWithRefetchMock,
- deleteExerciseMock,
+ removeExerciseMock,
unflagExerciseMock,
challengesQueryMock,
addChallengeQueryMock
diff --git a/__tests__/pages/curriculum/[lessonSlug]/mentor/index.test.js b/__tests__/pages/curriculum/[lessonSlug]/mentor/index.test.js
index 85ccba0af..7bd998044 100644
--- a/__tests__/pages/curriculum/[lessonSlug]/mentor/index.test.js
+++ b/__tests__/pages/curriculum/[lessonSlug]/mentor/index.test.js
@@ -6,7 +6,7 @@ import { useRouter } from 'next/router'
import { MockedProvider } from '@apollo/client/testing'
import getExercisesData from '../../../../../__dummy__/getExercisesData'
import GET_EXERCISES from '../../../../../graphql/queries/getExercises'
-import DELETE_EXERCISE from '../../../../../graphql/queries/deleteExercise'
+import REMOVE_EXERCISE from '../../../../../graphql/queries/removeExercise'
import GET_SESSION from '../../../../../graphql/queries/getSession'
import dummySessionData from '../../../../../__dummy__/sessionData'
import userEvent from '@testing-library/user-event'
@@ -81,7 +81,7 @@ describe('Mentor page', () => {
expect(await screen.findByText('500 Error!')).toBeInTheDocument()
})
- test('Should delete exercise', async () => {
+ test('Should remove exercise', async () => {
expect.assertions(1)
const mocks = [
@@ -109,21 +109,21 @@ describe('Mentor page', () => {
},
{
request: {
- query: DELETE_EXERCISE,
+ query: REMOVE_EXERCISE,
variables: {
id: 1
}
},
result: {
data: {
- deleteExercise: {
+ removeExercise: {
id: 1
}
}
},
newData: jest.fn(() => ({
data: {
- deleteExercise: {
+ removeExercise: {
id: 1
}
}
@@ -149,7 +149,7 @@ describe('Mentor page', () => {
expect(mocks.at(-1).newData).toBeCalled()
})
- test('Should delete exercise item and its QUERY INFO', async () => {
+ test('Should remove exercise item and its QUERY INFO', async () => {
expect.assertions(1)
const mocks = [
@@ -177,21 +177,21 @@ describe('Mentor page', () => {
},
{
request: {
- query: DELETE_EXERCISE,
+ query: REMOVE_EXERCISE,
variables: {
id: 1
}
},
result: {
data: {
- deleteExercise: {
+ removeExercise: {
id: 1
}
}
},
newData: jest.fn(() => ({
data: {
- deleteExercise: {
+ removeExercise: {
id: 2
}
}
diff --git a/components/ExercisePreviewCard/ExercisePreviewCard.tsx b/components/ExercisePreviewCard/ExercisePreviewCard.tsx
index 2bc0da66b..688e328b3 100644
--- a/components/ExercisePreviewCard/ExercisePreviewCard.tsx
+++ b/components/ExercisePreviewCard/ExercisePreviewCard.tsx
@@ -1,7 +1,7 @@
import { KebabHorizontalIcon } from '@primer/octicons-react'
import Markdown from 'markdown-to-jsx'
import React from 'react'
-import { useDeleteExerciseMutation } from '../../graphql'
+import { useRemoveExerciseMutation } from '../../graphql'
import { DropdownMenu } from '../DropdownMenu'
import QueryInfo from '../QueryInfo'
import styles from './exercisePreviewCard.module.scss'
@@ -23,7 +23,8 @@ const ExercisePreviewCard = ({
onDelete,
className = ''
}: ExercisePreviewCardProps) => {
- const [deleteExercise, { data, loading, error }] = useDeleteExerciseMutation()
+ const [removedExercise, { data, loading, error }] =
+ useRemoveExerciseMutation()
const [topBorderStyle, topMessageStyle] =
state === 'ANSWERED'
@@ -42,7 +43,7 @@ const ExercisePreviewCard = ({
>
{state &&
}
- {data && data.deleteExercise.id !== id ? (
+ {data && data.removeExercise.id !== id ? (
<>>
) : (
{
- await deleteExercise({
+ await removedExercise({
variables: {
id
}
diff --git a/components/admin/lessons/AdminLessonExerciseCard.test.js b/components/admin/lessons/AdminLessonExerciseCard.test.js
index c4971e366..4f2c589e9 100644
--- a/components/admin/lessons/AdminLessonExerciseCard.test.js
+++ b/components/admin/lessons/AdminLessonExerciseCard.test.js
@@ -3,7 +3,7 @@ import Component from './AdminLessonExerciseCard'
import userEvent from '@testing-library/user-event'
import { render, screen } from '@testing-library/react'
import { MockedProvider } from '@apollo/client/testing'
-import DELETE_EXERCISE from '../../../graphql/queries/deleteExercise'
+import REMOVE_EXERCISE from '../../../graphql/queries/removeExercise'
import REMOVE_EXERCISE_FLAG from '../../../graphql/queries/removeExerciseFlag'
// Imported to be able to use expect(...).toBeInTheDocument()
@@ -31,12 +31,12 @@ const exercise = {
const mocks = [
{
request: {
- query: DELETE_EXERCISE,
+ query: REMOVE_EXERCISE,
variables: { id: 1 }
},
result: {
data: {
- deleteExercise: {
+ removeExercise: {
id: 1
}
}
@@ -62,12 +62,12 @@ const mocks = [
const loadingMocks = [
{
request: {
- query: DELETE_EXERCISE,
+ query: REMOVE_EXERCISE,
variables: { id: 1 }
},
result: {
data: {
- deleteExercise: {
+ removeExercise: {
id: 1
}
}
@@ -120,12 +120,12 @@ describe('AdminLessonExerciseCard component', () => {
mocks={[
{
request: {
- query: DELETE_EXERCISE,
+ query: REMOVE_EXERCISE,
variables: { id: 1 }
},
result: {
data: {
- deleteExercise: {
+ removeExercise: {
id: null
}
}
diff --git a/components/admin/lessons/AdminLessonExerciseCard.tsx b/components/admin/lessons/AdminLessonExerciseCard.tsx
index 7f3627624..72ab5ec63 100644
--- a/components/admin/lessons/AdminLessonExerciseCard.tsx
+++ b/components/admin/lessons/AdminLessonExerciseCard.tsx
@@ -4,7 +4,7 @@ import React, { useState } from 'react'
import { Collapse, Spinner } from 'react-bootstrap'
import { PROFILE_PATH } from '../../../constants'
import {
- useDeleteExerciseMutation,
+ useRemoveExerciseMutation,
useRemoveExerciseFlagMutation,
Exercise,
User
@@ -95,23 +95,23 @@ type FooterProps = {
onUnflag?: (id: number) => void
}
const Footer = ({ exercise, onRemove, onUnflag }: FooterProps) => {
- const [deleteExercise, { loading: deleteLoading }] =
- useDeleteExerciseMutation()
+ const [removeExercise, { loading: removeLoading }] =
+ useRemoveExerciseMutation()
const [unflagExercise, { loading: unflagLoading }] =
useRemoveExerciseFlagMutation()
const handleRemove = async () => {
- const deletedExercise = await deleteExercise({
+ const removedExercise = await removeExercise({
variables: {
id: exercise.id
}
})
if (onRemove) {
- const deletedExerciseId = deletedExercise.data?.deleteExercise.id
+ const removedExerciseId = removedExercise.data?.removeExercise.id
- if (deletedExerciseId) {
- onRemove(deletedExerciseId)
+ if (removedExerciseId) {
+ onRemove(removedExerciseId)
}
}
}
@@ -146,10 +146,10 @@ const Footer = ({ exercise, onRemove, onUnflag }: FooterProps) => {