From 6d84dfddcc19e14e777433b5bc3480642ca8efb6 Mon Sep 17 00:00:00 2001 From: Domagoj Kriskovic Date: Mon, 6 Oct 2025 10:29:05 +0200 Subject: [PATCH] Skip checking status code for fetchJson GitOrigin-RevId: 1470fdd5aabde3448c5ac5ed8e9203fc509b13e8 --- .../js/helpers/ProjectHistoryClient.js | 40 +++++-------------- 1 file changed, 10 insertions(+), 30 deletions(-) diff --git a/services/project-history/test/acceptance/js/helpers/ProjectHistoryClient.js b/services/project-history/test/acceptance/js/helpers/ProjectHistoryClient.js index 4b2d62df85..d56b6add1c 100644 --- a/services/project-history/test/acceptance/js/helpers/ProjectHistoryClient.js +++ b/services/project-history/test/acceptance/js/helpers/ProjectHistoryClient.js @@ -5,6 +5,7 @@ import RedisWrapper from '@overleaf/redis-wrapper' import { db } from '../../../../app/js/mongodb.js' import { promisify } from '@overleaf/promise-utils' import { + fetchJson, fetchJsonWithResponse, fetchNothing, fetchStringWithResponse, @@ -64,9 +65,7 @@ export async function getSummarizedUpdates(projectId, query) { url.searchParams.set(key, query[key]) }) - const { response, json } = await fetchJsonWithResponse(url.toString()) - expect(response.status).to.equal(200) - return json + return await fetchJson(url.toString()) } export async function getDiff(projectId, pathname, from, to) { @@ -75,9 +74,7 @@ export async function getDiff(projectId, pathname, from, to) { url.searchParams.set('from', from) url.searchParams.set('to', to) - const { response, json } = await fetchJsonWithResponse(url.toString()) - expect(response.status).to.equal(200) - return json + return await fetchJson(url.toString()) } export async function getFileTreeDiff(projectId, from, to) { @@ -116,11 +113,7 @@ export async function getChangesInChunkSince(projectId, since, options = {}) { } export async function getLatestSnapshot(projectId) { - const { response, json } = await fetchJsonWithResponse( - `http://127.0.0.1:3054/project/${projectId}/snapshot` - ) - expect(response.status).to.equal(200) - return json + return await fetchJson(`http://127.0.0.1:3054/project/${projectId}/snapshot`) } export async function getSnapshot(projectId, pathname, version, options = {}) { @@ -210,23 +203,14 @@ export async function createLabel( comment, createdAt ) { - const { response, json } = await fetchJsonWithResponse( - `http://127.0.0.1:3054/project/${projectId}/labels`, - { - method: 'POST', - json: { comment, version, created_at: createdAt, user_id: userId }, - } - ) - expect(response.status).to.equal(200) - return json + return await fetchJson(`http://127.0.0.1:3054/project/${projectId}/labels`, { + method: 'POST', + json: { comment, version, created_at: createdAt, user_id: userId }, + }) } export async function getLabels(projectId) { - const { response, json } = await fetchJsonWithResponse( - `http://127.0.0.1:3054/project/${projectId}/labels` - ) - expect(response.status).to.equal(200) - return json + return await fetchJson(`http://127.0.0.1:3054/project/${projectId}/labels`) } export async function deleteLabelForUser(projectId, userId, labelId) { @@ -263,11 +247,7 @@ export async function transferLabelOwnership(fromUser, toUser) { } export async function getDump(projectId) { - const { response, json } = await fetchJsonWithResponse( - `http://127.0.0.1:3054/project/${projectId}/dump` - ) - expect(response.status).to.equal(200) - return json + return await fetchJson(`http://127.0.0.1:3054/project/${projectId}/dump`) } export async function deleteProject(projectId) {