fix: route recommend puzzle next through feed
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import type {
|
||||
DragPuzzlePieceRequest,
|
||||
AdvancePuzzleNextLevelRequest,
|
||||
DragPuzzlePieceRequest,
|
||||
PuzzleRunResponse,
|
||||
StartPuzzleRunRequest,
|
||||
SubmitPuzzleLeaderboardRequest,
|
||||
@@ -119,7 +119,7 @@ export async function dragPuzzlePieceOrGroup(
|
||||
}
|
||||
|
||||
/**
|
||||
* 进入推荐出的下一关。
|
||||
* 进入当前 run 的下一关。
|
||||
*/
|
||||
export async function advancePuzzleNextLevel(
|
||||
runId: string,
|
||||
@@ -128,10 +128,8 @@ export async function advancePuzzleNextLevel(
|
||||
) {
|
||||
const requestOptions = buildRuntimeGuestAuthOptions(options);
|
||||
const targetProfileId = payload.targetProfileId?.trim() ?? '';
|
||||
const preferSimilarWork = payload.preferSimilarWork === true;
|
||||
const requestPayload = {
|
||||
...(targetProfileId ? { targetProfileId } : {}),
|
||||
...(preferSimilarWork ? { preferSimilarWork: true } : {}),
|
||||
};
|
||||
const hasRequestPayload = Object.keys(requestPayload).length > 0;
|
||||
return requestJson<PuzzleRunResponse>(
|
||||
|
||||
@@ -13,8 +13,8 @@ vi.mock('./apiClient', async () => {
|
||||
};
|
||||
});
|
||||
|
||||
import { startBigFishRun } from './big-fish-runtime/bigFishRuntimeClient';
|
||||
import { startBarkBattleRun } from './bark-battle-runtime/barkBattleRuntimeClient';
|
||||
import { startBigFishRun } from './big-fish-runtime/bigFishRuntimeClient';
|
||||
import { startJumpHopRuntimeRun } from './jump-hop/jumpHopClient';
|
||||
import { startMatch3DRun } from './match3d-runtime/match3dRuntimeClient';
|
||||
import {
|
||||
@@ -130,10 +130,10 @@ describe('recommended runtime guest launch clients', () => {
|
||||
},
|
||||
);
|
||||
|
||||
it('puzzle next level can carry preferSimilarWork through the runtime guest request', async () => {
|
||||
it('puzzle next level keeps the default current-run handoff without a request body', async () => {
|
||||
await advancePuzzleNextLevel(
|
||||
'run-puzzle-1',
|
||||
{ preferSimilarWork: true },
|
||||
{},
|
||||
{ runtimeGuestToken: 'runtime-guest-token' },
|
||||
);
|
||||
|
||||
@@ -144,11 +144,10 @@ describe('recommended runtime guest launch clients', () => {
|
||||
method: 'POST',
|
||||
headers: expect.objectContaining({
|
||||
Authorization: 'Bearer runtime-guest-token',
|
||||
'Content-Type': 'application/json',
|
||||
}),
|
||||
body: JSON.stringify({ preferSimilarWork: true }),
|
||||
}),
|
||||
);
|
||||
expect(init.body).toBeUndefined();
|
||||
expect(options).toEqual(
|
||||
expect.objectContaining({
|
||||
skipAuth: true,
|
||||
|
||||
Reference in New Issue
Block a user