Skip to content

Commit

Permalink
Merge pull request #21 from VinyarionHyarmendacil/user-endpoints-0
Browse files Browse the repository at this point in the history
User- and file-related endpoints
  • Loading branch information
jellejurre authored Nov 20, 2024
2 parents cf7cd68 + 115aa19 commit 87e2e88
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tests/favorites.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,8 @@ test(testOperation, "updateFavoriteGroup", {
statusCode: 200
});

test.todo("Clear Favorite Group");
test.todo("Clear Favorite Group");

test(testOperation, "getFavoriteLimits", {
statusCode: 200
});
27 changes: 27 additions & 0 deletions tests/files.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { state, unstableValues } from "./_cache.js";
import { failUnauthenticated, test, testOperation } from "./_utilities.js";

const prominentAvatarFileId = "file_989feccd-3e6d-41f6-bf87-a8b3ece88438";
const prominentAvatarVersionId = 1;

test.before(failUnauthenticated);
test.serial(
"without data",
Expand Down Expand Up @@ -205,3 +208,27 @@ test.todo("Download File Version");
test.todo("Finish FileData Upload");
test.todo("Start FileData Upload");
test.todo("Check FileData Upload Status");

test(testOperation, "getFileAnalysis", {
parameters: {
fileId: prominentAvatarFileId,
versionId: prominentAvatarVersionId
},
statusCode: 200
});

test(testOperation, "getFileAnalysisSecurity", {
parameters: {
fileId: prominentAvatarFileId,
versionId: prominentAvatarVersionId
},
statusCode: 200
});

test(testOperation, "getFileAnalysisStandard", {
parameters: {
fileId: prominentAvatarFileId,
versionId: prominentAvatarVersionId
},
statusCode: 200
});
59 changes: 59 additions & 0 deletions tests/users.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { tupperUserId } from "./_consts.js";
import { failUnauthenticated, test, testOperation } from "./_utilities.js";
import { state, unstableValues } from "./_cache.js";

import type { LimitedUser } from "vrchat";

Expand Down Expand Up @@ -78,3 +79,61 @@ test(
test.todo("Update User Info");
test.todo("Get User Groups");
test.todo("Get User Group Requests");

test(testOperation, "getUserFeedback", {
parameters: {
userId: state.get("current-user").id,
n: 100,
offset: 0
},
statusCode: 200,
unstable: true
});

test(testOperation, "getUserNotes", {
parameters: {
n: 100,
offset: 0
},
statusCode: 200,
unstable: true
});

test.serial(
testOperation,
"updateUserNote",
{
parameters: {},
requestBody: {
targetUserId: tupperUserId,
note: "system_haha_we_actually_ended_up_documenting_this_one_too"
},
statusCode: 200
},
(t) => {
const { context } = t;

state.set("tupper-user-note", context.body);

t.is(context.body.targetUserId, tupperUserId, "Should be the same user");
unstableValues.add(context.body.createdAt);
}
);

test.serial(
testOperation,
"getUserNote",
() => ({
parameters: {
userNoteId: state.get("tupper-user-note").id
},
statusCode: 200
}),
(t) => {
const { context } = t;

t.is(context.body.id, state.get("tupper-user-note").id, "Should be the same user note");
t.is(context.body.targetUserId, tupperUserId, "Should be the same user");
unstableValues.add(context.body.createdAt);
}
);

0 comments on commit 87e2e88

Please sign in to comment.