noblox.js-capsolver 4.10.4
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of noblox.js-capsolver might be problematic. Click here for more details.
- package/.eslintrc.js +21 -0
- package/.github/FUNDING.yml +3 -0
- package/.github/ISSUE_TEMPLATE/bug_report.md +29 -0
- package/.github/ISSUE_TEMPLATE/feature_request.md +22 -0
- package/.github/workflows/doc-publish.yml +33 -0
- package/.github/workflows/npmpublish.yml +70 -0
- package/.travis.yml +13 -0
- package/CODE_OF_CONDUCT.md +76 -0
- package/LICENSE +21 -0
- package/README.md +168 -0
- package/examples/cleanPlayers.js +130 -0
- package/examples/cleanWall.js +110 -0
- package/examples/revertRanks.js +100 -0
- package/examples/savePlayers.js +119 -0
- package/examples/saveWall.js +96 -0
- package/img/moderatedThumbnails/moderatedThumbnail_100x100.png +0 -0
- package/img/moderatedThumbnails/moderatedThumbnail_110x110.png +0 -0
- package/img/moderatedThumbnails/moderatedThumbnail_140x140.png +0 -0
- package/img/moderatedThumbnails/moderatedThumbnail_150x150.png +0 -0
- package/img/moderatedThumbnails/moderatedThumbnail_150x200.png +0 -0
- package/img/moderatedThumbnails/moderatedThumbnail_180x180.png +0 -0
- package/img/moderatedThumbnails/moderatedThumbnail_250x250.png +0 -0
- package/img/moderatedThumbnails/moderatedThumbnail_30x30.png +0 -0
- package/img/moderatedThumbnails/moderatedThumbnail_352x352.png +0 -0
- package/img/moderatedThumbnails/moderatedThumbnail_420x420.png +0 -0
- package/img/moderatedThumbnails/moderatedThumbnail_48x48.png +0 -0
- package/img/moderatedThumbnails/moderatedThumbnail_50x50.png +0 -0
- package/img/moderatedThumbnails/moderatedThumbnail_60x60.png +0 -0
- package/img/moderatedThumbnails/moderatedThumbnail_720x720.png +0 -0
- package/img/moderatedThumbnails/moderatedThumbnail_75x75.png +0 -0
- package/img/noblox-js-small.png +0 -0
- package/img/noblox-js.png +0 -0
- package/img/thumbnailSizes.png +0 -0
- package/jsDocsConfig.json +55 -0
- package/lib/accountinformation/getUserSocialLinks.js +42 -0
- package/lib/accountsettings/block.js +58 -0
- package/lib/accountsettings/unblock.js +58 -0
- package/lib/asset/deleteFromInventory.js +69 -0
- package/lib/asset/getGamePassProductInfo.js +51 -0
- package/lib/asset/getProductInfo.js +56 -0
- package/lib/asset/uploadAnimation.js +103 -0
- package/lib/asset/uploadItem.js +83 -0
- package/lib/asset/uploadModel.js +90 -0
- package/lib/avatar/avatarRules.js +38 -0
- package/lib/avatar/currentlyWearing.js +32 -0
- package/lib/avatar/getAvatar.js +35 -0
- package/lib/avatar/getCurrentAvatar.js +37 -0
- package/lib/avatar/getRecentItems.js +37 -0
- package/lib/avatar/outfitDetails.js +32 -0
- package/lib/avatar/outfits.js +37 -0
- package/lib/avatar/redrawAvatar.js +48 -0
- package/lib/avatar/removeAssetId.js +55 -0
- package/lib/avatar/setAvatarBodyColors.js +60 -0
- package/lib/avatar/setAvatarScales.js +60 -0
- package/lib/avatar/setPlayerAvatarType.js +50 -0
- package/lib/avatar/setWearingAssets.js +50 -0
- package/lib/avatar/wearAssetId.js +55 -0
- package/lib/badges/getAwardedTimestamps.js +52 -0
- package/lib/badges/getBadgeInfo.js +43 -0
- package/lib/badges/getGameBadges.js +62 -0
- package/lib/badges/getPlayerBadges.js +28 -0
- package/lib/badges/updateBadgeInfo.js +80 -0
- package/lib/cache/add.js +14 -0
- package/lib/cache/addIf.js +26 -0
- package/lib/cache/clear.js +8 -0
- package/lib/cache/get.js +28 -0
- package/lib/cache/index.js +17 -0
- package/lib/cache/new.js +12 -0
- package/lib/cache/wrap.js +25 -0
- package/lib/chat/addUsersToConversation.js +61 -0
- package/lib/chat/chatSettings.js +33 -0
- package/lib/chat/getChatMessages.js +40 -0
- package/lib/chat/getConversations.js +43 -0
- package/lib/chat/getRolloutSettings.js +35 -0
- package/lib/chat/getUnreadConversationCount.js +33 -0
- package/lib/chat/getUnreadMessages.js +38 -0
- package/lib/chat/getUserConversations.js +37 -0
- package/lib/chat/markChatAsRead.js +52 -0
- package/lib/chat/markChatAsSeen.js +50 -0
- package/lib/chat/multiGetLatestMessages.js +37 -0
- package/lib/chat/onNewConversation.js +50 -0
- package/lib/chat/onNewMessage.js +53 -0
- package/lib/chat/onNewMessageBySelf.js +50 -0
- package/lib/chat/onUserOnline.js +50 -0
- package/lib/chat/onUserTyping.js +54 -0
- package/lib/chat/removeFromGroupConversation.js +62 -0
- package/lib/chat/renameGroupConversation.js +57 -0
- package/lib/chat/sendChatMessage.js +57 -0
- package/lib/chat/setChatUserTyping.js +61 -0
- package/lib/chat/start121Conversation.js +50 -0
- package/lib/chat/startCloudEditConversation.js +50 -0
- package/lib/chat/startGroupConversation.js +62 -0
- package/lib/client/onNotification.js +70 -0
- package/lib/client/setAPIKey.js +18 -0
- package/lib/client/setCookie.js +38 -0
- package/lib/datastores/deleteDatastoreEntry.js +66 -0
- package/lib/datastores/getDatastoreEntry.js +98 -0
- package/lib/datastores/getDatastoreEntryVersions.js +83 -0
- package/lib/datastores/getDatastoreKeys.js +73 -0
- package/lib/datastores/getDatastores.js +72 -0
- package/lib/datastores/incrementDatastoreEntry.js +93 -0
- package/lib/datastores/setDatastoreEntry.js +90 -0
- package/lib/develop/canManage.js +44 -0
- package/lib/develop/configureItem.js +142 -0
- package/lib/develop/updateUniverse.js +53 -0
- package/lib/develop/updateUniverseAccess.js +55 -0
- package/lib/economy/buy.js +99 -0
- package/lib/economy/getGroupFunds.js +43 -0
- package/lib/economy/getGroupRevenueSummary.js +48 -0
- package/lib/economy/getGroupTransactions.js +32 -0
- package/lib/economy/getResaleData.js +54 -0
- package/lib/economy/getResellers.js +35 -0
- package/lib/economy/getUserTransactions.js +34 -0
- package/lib/economy/onGroupTransaction.js +74 -0
- package/lib/friends/acceptFriendRequest.js +59 -0
- package/lib/friends/declineAllFriendRequests.js +57 -0
- package/lib/friends/declineFriendRequest.js +59 -0
- package/lib/friends/getFollowers.js +61 -0
- package/lib/friends/getFollowings.js +61 -0
- package/lib/friends/getFriendRequests.js +56 -0
- package/lib/friends/getFriends.js +53 -0
- package/lib/friends/onFriendRequest.js +58 -0
- package/lib/friends/removeFriend.js +58 -0
- package/lib/friends/sendFriendRequest.js +59 -0
- package/lib/friends/unfollow.js +58 -0
- package/lib/games/addDeveloperProduct.js +65 -0
- package/lib/games/checkDeveloperProductName.js +39 -0
- package/lib/games/configureGamePass.js +146 -0
- package/lib/games/getDeveloperProducts.js +51 -0
- package/lib/games/getGameInstances.js +31 -0
- package/lib/games/getGamePasses.js +39 -0
- package/lib/games/getGameRevenue.js +49 -0
- package/lib/games/getGameSocialLinks.js +45 -0
- package/lib/games/getGroupGames.js +30 -0
- package/lib/games/getPlaceInfo.js +48 -0
- package/lib/games/getUniverseInfo.js +51 -0
- package/lib/games/updateDeveloperProduct.js +69 -0
- package/lib/groups/changeRank.js +59 -0
- package/lib/groups/deleteWallPost.js +64 -0
- package/lib/groups/deleteWallPostsByUser.js +59 -0
- package/lib/groups/demote.js +25 -0
- package/lib/groups/exile.js +59 -0
- package/lib/groups/getAuditLog.js +67 -0
- package/lib/groups/getGroup.js +57 -0
- package/lib/groups/getGroupSocialLinks.js +44 -0
- package/lib/groups/getGroups.js +88 -0
- package/lib/groups/getJoinRequest.js +52 -0
- package/lib/groups/getJoinRequests.js +58 -0
- package/lib/groups/getPlayers.js +108 -0
- package/lib/groups/getRankInGroup.js +52 -0
- package/lib/groups/getRankNameInGroup.js +52 -0
- package/lib/groups/getRole.js +64 -0
- package/lib/groups/getRolePermissions.js +51 -0
- package/lib/groups/getRoles.js +56 -0
- package/lib/groups/getShout.js +49 -0
- package/lib/groups/getWall.js +59 -0
- package/lib/groups/groupPayout.js +103 -0
- package/lib/groups/handleJoinRequest.js +60 -0
- package/lib/groups/leaveGroup.js +60 -0
- package/lib/groups/onAuditLog.js +62 -0
- package/lib/groups/onJoinRequest.js +63 -0
- package/lib/groups/onJoinRequestHandle.js +105 -0
- package/lib/groups/onShout.js +57 -0
- package/lib/groups/onWallPost.js +58 -0
- package/lib/groups/promote.js +25 -0
- package/lib/groups/searchGroups.js +32 -0
- package/lib/groups/setGroupDescription.js +65 -0
- package/lib/groups/setGroupName.js +66 -0
- package/lib/groups/setRank.js +79 -0
- package/lib/groups/shout.js +65 -0
- package/lib/index.js +30 -0
- package/lib/internal/levelOneCopy.js +16 -0
- package/lib/internal/queue.js +61 -0
- package/lib/internal/timeout.js +30 -0
- package/lib/internal/wrap.js +78 -0
- package/lib/inventory/getCollectibles.js +31 -0
- package/lib/inventory/getInventory.js +32 -0
- package/lib/inventory/getInventoryById.js +31 -0
- package/lib/inventory/getOwnership.js +54 -0
- package/lib/inventory/getUAIDs.js +47 -0
- package/lib/itemconfiguration/getGroupAssets.js +32 -0
- package/lib/options.js +26 -0
- package/lib/party/onPartyDeleted.js +53 -0
- package/lib/party/onPartyInvite.js +53 -0
- package/lib/party/onPartyJoinedGame.js +53 -0
- package/lib/party/onPartyLeftGame.js +53 -0
- package/lib/party/onPartySelfJoined.js +53 -0
- package/lib/party/onPartySelfLeft.js +53 -0
- package/lib/party/onPartyUserJoined.js +53 -0
- package/lib/party/onPartyUserLeft.js +53 -0
- package/lib/premiumfeatures/getPremium.js +51 -0
- package/lib/presence/getPresences.js +63 -0
- package/lib/privatemessages/getMessages.js +60 -0
- package/lib/privatemessages/message.js +80 -0
- package/lib/privatemessages/onMessage.js +88 -0
- package/lib/thumbnails/getLogo.js +60 -0
- package/lib/thumbnails/getPlayerThumbnail.js +121 -0
- package/lib/thumbnails/getThumbnails.js +93 -0
- package/lib/trades/acceptTrade.js +58 -0
- package/lib/trades/canTradeWith.js +48 -0
- package/lib/trades/counterTrade.js +84 -0
- package/lib/trades/declineTrade.js +58 -0
- package/lib/trades/getTradeInfo.js +52 -0
- package/lib/trades/getTrades.js +37 -0
- package/lib/trades/sendTrade.js +82 -0
- package/lib/users/getBlurb.js +36 -0
- package/lib/users/getIdFromUsername.js +53 -0
- package/lib/users/getPlayerInfo.js +100 -0
- package/lib/users/getUsernameFromId.js +44 -0
- package/lib/users/onBlurbChange.js +46 -0
- package/lib/util/clearSession.js +32 -0
- package/lib/util/generalRequest.js +61 -0
- package/lib/util/getAction.js +45 -0
- package/lib/util/getCurrentUser.js +44 -0
- package/lib/util/getGeneralToken.js +52 -0
- package/lib/util/getHash.js +29 -0
- package/lib/util/getInputs.js +37 -0
- package/lib/util/getPageResults.js +89 -0
- package/lib/util/getSenderUserId.js +30 -0
- package/lib/util/getSession.js +38 -0
- package/lib/util/getVerification.js +60 -0
- package/lib/util/getVerificationInputs.js +31 -0
- package/lib/util/http.js +110 -0
- package/lib/util/jar.js +24 -0
- package/lib/util/refreshCookie.js +52 -0
- package/lib/util/relog.js +81 -0
- package/lib/util/setOptions.js +54 -0
- package/lib/util/shortPoll.js +102 -0
- package/lib/util/threaded.js +80 -0
- package/package.json +94 -0
- package/postinstall.js +1 -0
- package/settings.json +107 -0
- package/test/accountinformation.test.js +27 -0
- package/test/accountsettings.test.js +27 -0
- package/test/asset.test.js +81 -0
- package/test/assets/Great-White-Shark-Fin.rbxm +0 -0
- package/test/assets/KeyframeSequence.rbxm +0 -0
- package/test/avatar.test.js +164 -0
- package/test/badges.test.js +96 -0
- package/test/chat.test.js +104 -0
- package/test/datastore.test.js +105 -0
- package/test/develop.test.js +53 -0
- package/test/economy.test.js +137 -0
- package/test/friends.test.js +128 -0
- package/test/games.test.js +212 -0
- package/test/groups.test.js +311 -0
- package/test/inventory.test.js +98 -0
- package/test/itemconfiguration.test.js +24 -0
- package/test/premiumfeatures.test.js +17 -0
- package/test/presence.test.js +25 -0
- package/test/privatemessages.test.js +33 -0
- package/test/thumbnails.test.js +53 -0
- package/test/users.test.js +68 -0
- package/tutorials/Authentication.md +75 -0
- package/tutorials/Event Emitters.md +26 -0
- package/tutorials/Promises.md +86 -0
- package/tutorials/VPS Authentication.md +72 -0
- package/typings/index.d.ts +2525 -0
- package/typings/jsDocs.ts +1927 -0
@@ -0,0 +1,96 @@
|
|
1
|
+
const { getAwardedTimestamps, getBadgeInfo, getGameBadges, getPlayerBadges, setCookie } = require('../lib')
|
2
|
+
|
3
|
+
beforeAll(() => {
|
4
|
+
return new Promise(resolve => {
|
5
|
+
setCookie(process.env.COOKIE).then(() => {
|
6
|
+
resolve()
|
7
|
+
})
|
8
|
+
})
|
9
|
+
})
|
10
|
+
|
11
|
+
describe('Badges Methods', () => {
|
12
|
+
it('getAwardedTimestamps() returns when badges were awarded to a player', () => {
|
13
|
+
return getAwardedTimestamps(64679301, [459405541]).then((res) => {
|
14
|
+
return expect(res).toMatchObject({
|
15
|
+
data: expect.any(Array)
|
16
|
+
})
|
17
|
+
})
|
18
|
+
})
|
19
|
+
|
20
|
+
it('getBadgeInfo() returns information on the provided badge ID', () => {
|
21
|
+
return getBadgeInfo(459405541).then((res) => {
|
22
|
+
return expect(res).toMatchObject({
|
23
|
+
id: expect.any(Number),
|
24
|
+
name: expect.any(String),
|
25
|
+
description: expect.any(String),
|
26
|
+
enabled: expect.any(Boolean),
|
27
|
+
iconImageId: expect.any(Number),
|
28
|
+
created: expect.any(Date),
|
29
|
+
updated: expect.any(Date),
|
30
|
+
statistics: expect.any(Object),
|
31
|
+
awardingUniverse: expect.any(Object)
|
32
|
+
})
|
33
|
+
})
|
34
|
+
})
|
35
|
+
|
36
|
+
it('getGameBadges() returns information on the badges in a game', () => {
|
37
|
+
return getGameBadges(66654135).then((res) => {
|
38
|
+
return expect(res).toEqual(
|
39
|
+
expect.arrayContaining([
|
40
|
+
expect.objectContaining({
|
41
|
+
id: expect.any(Number),
|
42
|
+
name: expect.any(String),
|
43
|
+
description: expect.any(String),
|
44
|
+
displayName: expect.any(String),
|
45
|
+
displayDescription: expect.any(String),
|
46
|
+
enabled: expect.any(Boolean),
|
47
|
+
iconImageId: expect.any(Number),
|
48
|
+
displayIconImageId: expect.any(Number),
|
49
|
+
created: expect.any(Date),
|
50
|
+
updated: expect.any(Date),
|
51
|
+
statistics: expect.objectContaining({
|
52
|
+
pastDayAwardedCount: expect.any(Number),
|
53
|
+
awardedCount: expect.any(Number),
|
54
|
+
winRatePercentage: expect.any(Number)
|
55
|
+
}),
|
56
|
+
awardingUniverse: expect.objectContaining({
|
57
|
+
id: expect.any(Number),
|
58
|
+
name: expect.any(String),
|
59
|
+
rootPlaceId: expect.any(Number)
|
60
|
+
})
|
61
|
+
})
|
62
|
+
])
|
63
|
+
)
|
64
|
+
})
|
65
|
+
})
|
66
|
+
|
67
|
+
it('getPlayerBadges() returns information on badges a player has earned', () => {
|
68
|
+
return getPlayerBadges(55549140, 10).then((res) => {
|
69
|
+
return expect(res).toEqual(
|
70
|
+
expect.arrayContaining([
|
71
|
+
expect.objectContaining({
|
72
|
+
id: expect.any(Number),
|
73
|
+
name: expect.any(String),
|
74
|
+
description: expect.any(String),
|
75
|
+
displayName: expect.any(String),
|
76
|
+
displayDescription: expect.any(String),
|
77
|
+
enabled: expect.any(Boolean),
|
78
|
+
iconImageId: expect.any(Number),
|
79
|
+
displayIconImageId: expect.any(Number),
|
80
|
+
awarder: expect.objectContaining({
|
81
|
+
id: expect.any(Number),
|
82
|
+
type: expect.any(String)
|
83
|
+
}),
|
84
|
+
statistics: expect.objectContaining({
|
85
|
+
pastDayAwardedCount: expect.any(Number),
|
86
|
+
awardedCount: expect.any(Number),
|
87
|
+
winRatePercentage: expect.any(Number)
|
88
|
+
}),
|
89
|
+
created: expect.any(Date),
|
90
|
+
updated: expect.any(Date)
|
91
|
+
})
|
92
|
+
])
|
93
|
+
)
|
94
|
+
})
|
95
|
+
})
|
96
|
+
})
|
@@ -0,0 +1,104 @@
|
|
1
|
+
const { addUsersToConversation, chatSettings, getChatMessages, getConversations, getRolloutSettings, getUnreadConversationCount, getUnreadMessages, getUserConversations, markChatAsRead, markChatAsSeen, multiGetLatestMessages, removeFromGroupConversation, renameGroupConversation, sendChatMessage, setChatUserTyping, start121Conversation, startGroupConversation, setCookie } = require('../lib')
|
2
|
+
|
3
|
+
beforeAll(() => {
|
4
|
+
return new Promise(resolve => {
|
5
|
+
setCookie(process.env.COOKIE).then(() => {
|
6
|
+
resolve()
|
7
|
+
})
|
8
|
+
})
|
9
|
+
})
|
10
|
+
|
11
|
+
describe('Chat Methods', () => {
|
12
|
+
let newConversationId
|
13
|
+
|
14
|
+
it('addUsersToConversation() adds additional user(s) to form a group chat', () => {
|
15
|
+
return addUsersToConversation(8212952828, [3187412077]).then((res) => {
|
16
|
+
if (res && res.conversationId) newConversationId = res.conversationId
|
17
|
+
|
18
|
+
expect(res).toEqual(
|
19
|
+
expect.objectContaining({
|
20
|
+
conversationId: expect.any(Number)
|
21
|
+
})
|
22
|
+
)
|
23
|
+
})
|
24
|
+
})
|
25
|
+
|
26
|
+
it('chatSettings() returns chat settings', () => {
|
27
|
+
return chatSettings().then((res) => {
|
28
|
+
expect(res).toMatchObject({
|
29
|
+
chatEnabled: expect.any(Boolean),
|
30
|
+
isActiveChatUser: expect.any(Boolean)
|
31
|
+
})
|
32
|
+
})
|
33
|
+
})
|
34
|
+
|
35
|
+
it('getChatMessages() returns chat messages', async () => {
|
36
|
+
await expect(getChatMessages(8212952828)).resolves.not.toThrow()
|
37
|
+
})
|
38
|
+
|
39
|
+
it('getConversations() returns chat conversations that fit the provided IDs', async () => {
|
40
|
+
await expect(getConversations([8212952828])).resolves.not.toThrow()
|
41
|
+
})
|
42
|
+
|
43
|
+
it('getRolloutSettings() returns rollout settings for chat features', async () => {
|
44
|
+
await expect(getRolloutSettings(['LuaChat', 'Party'])).resolves.not.toThrow()
|
45
|
+
})
|
46
|
+
|
47
|
+
it('getUnreadConversationCount() returns number of unread conversations', () => {
|
48
|
+
return getUnreadConversationCount().then((res) => {
|
49
|
+
expect(res).toMatchObject({
|
50
|
+
count: expect.any(Number)
|
51
|
+
})
|
52
|
+
})
|
53
|
+
})
|
54
|
+
|
55
|
+
it('getUnreadMessages() returns unread messages in a given conversation', async () => {
|
56
|
+
await expect(getUnreadMessages([8212952828])).resolves.not.toThrow()
|
57
|
+
})
|
58
|
+
|
59
|
+
it('getUserConversations() returns all conversations the logged in user is in', async () => {
|
60
|
+
await expect(getUserConversations()).resolves.not.toThrow()
|
61
|
+
})
|
62
|
+
|
63
|
+
it('markChatAsRead() marks a conversation\'s messages as read to the specified message', async () => {
|
64
|
+
await expect(markChatAsRead(8212952828, 'e775e103-876f-4332-84ab-1ea14f326d39')).resolves.not.toThrow()
|
65
|
+
})
|
66
|
+
|
67
|
+
it('markChatAsSeen() marks the conversations provided as seen', async () => {
|
68
|
+
await expect(markChatAsSeen([8212952828])).resolves.not.toThrow()
|
69
|
+
})
|
70
|
+
|
71
|
+
it('multiGetLatestMessages() returns the latest messages corresponding to the given list of conversation IDs', async () => {
|
72
|
+
await expect(multiGetLatestMessages([8212952828])).resolves.not.toThrow()
|
73
|
+
})
|
74
|
+
|
75
|
+
it('removeFromGroupConversation() removes a user from a given conversation', async () => {
|
76
|
+
await expect(removeFromGroupConversation(newConversationId, 3187412077)).resolves.not.toThrow()
|
77
|
+
})
|
78
|
+
|
79
|
+
it('renameGroupConversation() renames a group conversation', async () => {
|
80
|
+
await expect(renameGroupConversation(newConversationId, 'noblox testing')).resolves.not.toThrow()
|
81
|
+
})
|
82
|
+
|
83
|
+
it('sendChatMessage() sends a chat message with provided content', async () => {
|
84
|
+
await expect(sendChatMessage(newConversationId, 'This is a test.')).resolves.not.toThrow()
|
85
|
+
})
|
86
|
+
|
87
|
+
it('setChatUserTyping() toggles typing status', async () => {
|
88
|
+
return setChatUserTyping(newConversationId, false).then((res) => {
|
89
|
+
expect(res).toMatchObject({ resultType: 'Success' })
|
90
|
+
})
|
91
|
+
})
|
92
|
+
|
93
|
+
it('start121Conversation() starts a conversation with another user', async () => {
|
94
|
+
await expect(start121Conversation(3187412077)).resolves.not.toThrow()
|
95
|
+
})
|
96
|
+
|
97
|
+
// TODO: startCloudEditConversation
|
98
|
+
|
99
|
+
it('startGroupConversation() opens a conversation with multiple people in it', () => {
|
100
|
+
return startGroupConversation([55549140, 3187412077], 'noblox test 2').then((res) => {
|
101
|
+
expect(res).toMatchObject({ resultType: 'Success' })
|
102
|
+
})
|
103
|
+
})
|
104
|
+
})
|
@@ -0,0 +1,105 @@
|
|
1
|
+
const { deleteDatastoreEntry, getDatastoreEntry, getDatastoreEntryVersions, setDatastoreEntry, getDatastoreKeys, getDatastores, incrementDatastoreEntry, setAPIKey } = require('../lib')
|
2
|
+
|
3
|
+
beforeAll(() => {
|
4
|
+
setAPIKey(process.env.API_KEY)
|
5
|
+
})
|
6
|
+
|
7
|
+
describe('Data Store Methods', () => {
|
8
|
+
it('setDatastoreEntry() sets a datastore entry to the specified value', async () => {
|
9
|
+
return setDatastoreEntry({ universeId: 79354837, datastoreName: 'noblox_testing', entryKey: 'test1', body: 230, robloxEntryUserIDs: [55549140] }).then((res) => {
|
10
|
+
expect(res).toMatchObject({
|
11
|
+
version: expect.any(String),
|
12
|
+
deleted: expect.any(Boolean),
|
13
|
+
contentLength: expect.any(Number),
|
14
|
+
createdTime: expect.any(Date),
|
15
|
+
objectCreatedTime: expect.any(Date)
|
16
|
+
})
|
17
|
+
})
|
18
|
+
})
|
19
|
+
|
20
|
+
it('getDatastores() returns all datastores in a universe', async () => {
|
21
|
+
return getDatastores(79354837).then((res) => {
|
22
|
+
return expect(res).toMatchObject({
|
23
|
+
datastores: expect.arrayContaining([
|
24
|
+
expect.objectContaining({
|
25
|
+
name: expect.any(String),
|
26
|
+
createdTime: expect.any(Date)
|
27
|
+
})
|
28
|
+
]),
|
29
|
+
nextPageCursor: expect.toBeOneOf([expect.any(String), null])
|
30
|
+
})
|
31
|
+
})
|
32
|
+
})
|
33
|
+
|
34
|
+
it('getDatastoreEntry() returns a datastore entry', async () => {
|
35
|
+
return getDatastoreEntry({ universeId: 79354837, datastoreName: 'noblox_testing', entryKey: 'test1' }).then((res) => {
|
36
|
+
return expect(res).toMatchObject({
|
37
|
+
data: expect.anything(),
|
38
|
+
metadata: expect.objectContaining({
|
39
|
+
robloxEntryCreatedTime: expect.any(Date),
|
40
|
+
lastModified: expect.any(Date),
|
41
|
+
robloxEntryVersion: expect.any(String),
|
42
|
+
robloxEntryAttributes: expect.toBeOneOf([expect.any(String), undefined]),
|
43
|
+
robloxEntryUserIDs: expect.toBeOneOf([expect.any(String), undefined]),
|
44
|
+
contentMD5: expect.any(String),
|
45
|
+
contentLength: expect.any(Number)
|
46
|
+
})
|
47
|
+
})
|
48
|
+
})
|
49
|
+
})
|
50
|
+
|
51
|
+
it('getDatastoreKeys() returns all the keys in a datastore', async () => {
|
52
|
+
return getDatastoreKeys({ universeId: 79354837, datastoreName: 'noblox_testing' }).then((res) => {
|
53
|
+
return expect(res).toMatchObject({
|
54
|
+
keys: expect.arrayContaining([
|
55
|
+
expect.objectContaining({
|
56
|
+
scope: expect.any(String),
|
57
|
+
key: expect.any(String)
|
58
|
+
})
|
59
|
+
]),
|
60
|
+
nextPageCursor: expect.any(String)
|
61
|
+
})
|
62
|
+
})
|
63
|
+
})
|
64
|
+
|
65
|
+
it('incrementDatastoreEntry() increments an entry by one', async () => {
|
66
|
+
await setDatastoreEntry({ universeId: 79354837, datastoreName: 'noblox_testing', entryKey: 'test1', body: 230, robloxEntryUserIDs: [55549140] })
|
67
|
+
return incrementDatastoreEntry({ universeId: 79354837, datastoreName: 'noblox_testing', entryKey: 'test1', incrementBy: 1 }).then((res) => {
|
68
|
+
return expect(res).toMatchObject({
|
69
|
+
data: 231,
|
70
|
+
metadata: expect.objectContaining({
|
71
|
+
robloxEntryCreatedTime: expect.any(Date),
|
72
|
+
lastModified: expect.any(Date),
|
73
|
+
robloxEntryVersion: expect.any(String),
|
74
|
+
robloxEntryAttributes: expect.toBeOneOf([expect.any(String), undefined]),
|
75
|
+
robloxEntryUserIDs: expect.toBeOneOf([expect.any(String), undefined]),
|
76
|
+
contentMD5: expect.any(String),
|
77
|
+
contentLength: expect.any(Number)
|
78
|
+
})
|
79
|
+
})
|
80
|
+
})
|
81
|
+
})
|
82
|
+
|
83
|
+
it('getDatastoreEntryVersions() returns versions of an entry in a datastore', async () => {
|
84
|
+
return getDatastoreEntryVersions({ universeId: 79354837, datastoreName: 'noblox_testing', entryKey: 'test1' }).then((res) => {
|
85
|
+
return expect(res).toMatchObject({
|
86
|
+
versions: expect.arrayContaining([
|
87
|
+
expect.objectContaining({
|
88
|
+
version: expect.any(String),
|
89
|
+
deleted: expect.any(Boolean),
|
90
|
+
contentLength: expect.any(Number),
|
91
|
+
createdTime: expect.any(Date),
|
92
|
+
objectCreatedTime: expect.any(Date)
|
93
|
+
})
|
94
|
+
]),
|
95
|
+
nextPageCursor: expect.any(String)
|
96
|
+
})
|
97
|
+
})
|
98
|
+
})
|
99
|
+
|
100
|
+
it('deleteDatastoreEntry() deletes an entry from the datastore', async () => {
|
101
|
+
await setDatastoreEntry({ universeId: 79354837, datastoreName: 'noblox_testing', entryKey: 'test2', body: 'delete me!' })
|
102
|
+
|
103
|
+
return await expect(deleteDatastoreEntry({ universeId: 79354837, datastoreName: 'noblox_testing', entryKey: 'test2' })).resolves.not.toThrow()
|
104
|
+
})
|
105
|
+
})
|
@@ -0,0 +1,53 @@
|
|
1
|
+
const { canManage, configureItem, getProductInfo, updateUniverse, updateUniverseAccess, setCookie } = require('../lib')
|
2
|
+
|
3
|
+
beforeAll(() => {
|
4
|
+
return new Promise(resolve => {
|
5
|
+
setCookie(process.env.COOKIE).then(() => {
|
6
|
+
resolve()
|
7
|
+
})
|
8
|
+
})
|
9
|
+
})
|
10
|
+
|
11
|
+
describe('Develop Methods', () => {
|
12
|
+
it('canManage() checks if a user can manage an asset', () => {
|
13
|
+
return canManage(2416399685, 6792044666).then((res) => {
|
14
|
+
return expect(res).toBe(true)
|
15
|
+
})
|
16
|
+
})
|
17
|
+
|
18
|
+
it('configureItem() successfully configures an item user owns', () => {
|
19
|
+
return configureItem(1989194006, 'Main t-shirt', 'Uploaded by me').then(() => {
|
20
|
+
return getProductInfo(1989194006).then((res) => {
|
21
|
+
return expect(res).toMatchObject({
|
22
|
+
Name: 'Main t-shirt',
|
23
|
+
Description: 'Uploaded by me'
|
24
|
+
})
|
25
|
+
})
|
26
|
+
})
|
27
|
+
})
|
28
|
+
|
29
|
+
it('updateUniverse() should update a universe with the provided settings', () => {
|
30
|
+
return updateUniverse(79354837, { description: 'Testing 1234' }).then((res) => {
|
31
|
+
return expect(res).toEqual(
|
32
|
+
expect.objectContaining({
|
33
|
+
genre: expect.any(String),
|
34
|
+
id: expect.any(Number),
|
35
|
+
isArchived: expect.any(Boolean),
|
36
|
+
isForSale: expect.any(Boolean),
|
37
|
+
isFriendsOnly: expect.any(Boolean),
|
38
|
+
name: expect.any(String),
|
39
|
+
playableDevices: expect.any(Array),
|
40
|
+
price: expect.any(Number),
|
41
|
+
universeAnimationType: expect.any(String),
|
42
|
+
universeAvatarType: expect.any(String),
|
43
|
+
universeCollisionType: expect.any(String),
|
44
|
+
universeJointPositioningType: expect.any(String)
|
45
|
+
})
|
46
|
+
)
|
47
|
+
})
|
48
|
+
})
|
49
|
+
|
50
|
+
it('updateUniverseAccess() should update a universe\'s public access setting.', async () => {
|
51
|
+
await expect(updateUniverseAccess(79354837, true)).resolves.not.toThrow()
|
52
|
+
})
|
53
|
+
})
|
@@ -0,0 +1,137 @@
|
|
1
|
+
const { buy, getGroupFunds, getGroupRevenueSummary, getGroupTransactions, getResaleData, getResellers, getUserTransactions, setCookie } = require('../lib')
|
2
|
+
|
3
|
+
beforeAll(() => {
|
4
|
+
return new Promise(resolve => {
|
5
|
+
setCookie(process.env.COOKIE).then(() => {
|
6
|
+
resolve()
|
7
|
+
})
|
8
|
+
})
|
9
|
+
})
|
10
|
+
|
11
|
+
describe('Economy Methods', () => {
|
12
|
+
it('buy() successfully purchases an item', () => {
|
13
|
+
return buy(1778181).then(res => {
|
14
|
+
return expect(res).toEqual({
|
15
|
+
productId: expect.any(Number),
|
16
|
+
price: expect.any(Number)
|
17
|
+
})
|
18
|
+
})
|
19
|
+
})
|
20
|
+
|
21
|
+
it('getGroupFunds() returns amount of robux in group funds', () => {
|
22
|
+
return getGroupFunds(9997719).then((res) => {
|
23
|
+
return expect(res).toEqual(expect.any(Number))
|
24
|
+
})
|
25
|
+
})
|
26
|
+
|
27
|
+
it('getGroupRevenueSummary() returns a revenue summary for a group', () => {
|
28
|
+
return getGroupRevenueSummary(9997719).then((res) => {
|
29
|
+
return expect(res).toMatchObject({
|
30
|
+
recurringRobuxStipend: expect.any(Number),
|
31
|
+
itemSaleRobux: expect.any(Number),
|
32
|
+
purchasedRobux: expect.any(Number),
|
33
|
+
tradeSystemRobux: expect.any(Number),
|
34
|
+
pendingRobux: expect.any(Number),
|
35
|
+
groupPayoutRobux: expect.any(Number),
|
36
|
+
individualToGroupRobux: expect.any(Number),
|
37
|
+
premiumPayouts: expect.any(Number),
|
38
|
+
groupPremiumPayouts: expect.any(Number),
|
39
|
+
adjustmentRobux: expect.any(Number)
|
40
|
+
})
|
41
|
+
})
|
42
|
+
})
|
43
|
+
|
44
|
+
it('getGroupTransactions() returns transactions related to a group', () => {
|
45
|
+
return getGroupTransactions(4591072).then((res) => {
|
46
|
+
return expect(res).toEqual(
|
47
|
+
expect.arrayContaining([
|
48
|
+
expect.objectContaining({
|
49
|
+
id: expect.any(Number),
|
50
|
+
created: expect.any(Date),
|
51
|
+
isPending: expect.any(Boolean),
|
52
|
+
currency: expect.objectContaining({
|
53
|
+
amount: expect.any(Number),
|
54
|
+
type: expect.any(String)
|
55
|
+
}),
|
56
|
+
details: expect.objectContaining({
|
57
|
+
id: expect.any(Number),
|
58
|
+
name: expect.any(String),
|
59
|
+
type: expect.any(String)
|
60
|
+
}),
|
61
|
+
agent: expect.objectContaining({
|
62
|
+
id: expect.any(Number),
|
63
|
+
name: expect.any(String),
|
64
|
+
type: expect.any(String)
|
65
|
+
})
|
66
|
+
})
|
67
|
+
])
|
68
|
+
)
|
69
|
+
})
|
70
|
+
})
|
71
|
+
|
72
|
+
it('getResaleData() successfully returns a collectible\'s resale history', () => {
|
73
|
+
return getResaleData(20573078).then((res) => { // Shaggy
|
74
|
+
return expect(res).toMatchObject({
|
75
|
+
assetStock: expect.toBeOneOf([expect.any(Number), null]),
|
76
|
+
sales: expect.any(Number),
|
77
|
+
numberRemaining: expect.toBeOneOf([expect.any(Number), null]),
|
78
|
+
recentAveragePrice: expect.any(Number),
|
79
|
+
originalPrice: expect.toBeOneOf([expect.any(Number), null]),
|
80
|
+
priceDataPoints: expect.arrayContaining([
|
81
|
+
expect.objectContaining({
|
82
|
+
value: expect.toBeOneOf([expect.any(Number), null]),
|
83
|
+
date: expect.toBeOneOf([expect.any(Date), null])
|
84
|
+
})
|
85
|
+
])
|
86
|
+
})
|
87
|
+
})
|
88
|
+
})
|
89
|
+
|
90
|
+
it('getResellers() successfully returns a collectible\'s resellable copies', () => {
|
91
|
+
return getResellers(20573078).then((res) => { // Shaggy
|
92
|
+
return expect(res).toEqual(
|
93
|
+
expect.arrayContaining([
|
94
|
+
expect.objectContaining({
|
95
|
+
userAssetId: expect.any(Number),
|
96
|
+
price: expect.any(Number),
|
97
|
+
serialNumber: expect.toBeOneOf([expect.any(Number), null]),
|
98
|
+
seller: expect.objectContaining({
|
99
|
+
id: expect.any(Number),
|
100
|
+
type: expect.any(String),
|
101
|
+
name: expect.any(String)
|
102
|
+
})
|
103
|
+
})
|
104
|
+
])
|
105
|
+
)
|
106
|
+
})
|
107
|
+
})
|
108
|
+
|
109
|
+
it('getUserTransactions() returns the logged in user\'s transaction history', () => {
|
110
|
+
return getUserTransactions('Purchase').then(res => {
|
111
|
+
return expect(res).toEqual(
|
112
|
+
expect.arrayContaining([
|
113
|
+
expect.objectContaining({
|
114
|
+
id: expect.any(Number),
|
115
|
+
created: expect.any(Date),
|
116
|
+
isPending: expect.any(Boolean),
|
117
|
+
transactionType: expect.any(String),
|
118
|
+
agent: expect.objectContaining({
|
119
|
+
id: expect.any(Number),
|
120
|
+
type: expect.any(String),
|
121
|
+
name: expect.any(String)
|
122
|
+
}),
|
123
|
+
details: expect.objectContaining({
|
124
|
+
id: expect.any(Number),
|
125
|
+
name: expect.any(String),
|
126
|
+
type: expect.any(String)
|
127
|
+
}),
|
128
|
+
currency: expect.objectContaining({
|
129
|
+
amount: expect.any(Number),
|
130
|
+
type: expect.any(String)
|
131
|
+
})
|
132
|
+
})
|
133
|
+
])
|
134
|
+
)
|
135
|
+
})
|
136
|
+
})
|
137
|
+
})
|
@@ -0,0 +1,128 @@
|
|
1
|
+
const { acceptFriendRequest, declineAllFriendRequests, declineFriendRequest, getFollowers, getFollowings, getFriendRequests, getFriends, removeFriend, sendFriendRequest, unfollow, setCookie } = require('../lib')
|
2
|
+
|
3
|
+
beforeAll(() => {
|
4
|
+
return new Promise(resolve => {
|
5
|
+
setCookie(process.env.COOKIE).then(() => {
|
6
|
+
resolve()
|
7
|
+
})
|
8
|
+
})
|
9
|
+
})
|
10
|
+
|
11
|
+
describe('Friends Methods', () => {
|
12
|
+
it('sendFriendRequest() sends a friend request to the specified user', () => {
|
13
|
+
return removeFriend(857710783).then(async () => {
|
14
|
+
return await expect(sendFriendRequest(857710783)).resolves.not.toThrow()
|
15
|
+
})
|
16
|
+
})
|
17
|
+
|
18
|
+
it('acceptFriendRequest() accepts a friend request', async () => {
|
19
|
+
return setCookie(process.env.COOKIE_2).then(async () => {
|
20
|
+
return await expect(acceptFriendRequest(64679301)).resolves.not.toThrow()
|
21
|
+
})
|
22
|
+
})
|
23
|
+
it('removeFriend() unfriends a user', async () => {
|
24
|
+
return await expect(removeFriend(64679301)).resolves.not.toThrow()
|
25
|
+
})
|
26
|
+
|
27
|
+
it('declineAllFriendRequests() declines all friend requests', async () => {
|
28
|
+
return await expect(declineAllFriendRequests()).resolves.not.toThrow()
|
29
|
+
})
|
30
|
+
|
31
|
+
it('unfollow() unfollows a user on Roblox', async () => {
|
32
|
+
return await expect(unfollow(55549140)).resolves.not.toThrow()
|
33
|
+
})
|
34
|
+
|
35
|
+
it('getFollowers() returns a user\'s followers', () => {
|
36
|
+
return getFollowers(55549140).then((res) => {
|
37
|
+
return expect(res).toMatchObject({
|
38
|
+
previousPageCursor: expect.toBeOneOf([expect.any(String), null]),
|
39
|
+
nextPageCursor: expect.toBeOneOf([expect.any(String), null]),
|
40
|
+
data: expect.arrayContaining([
|
41
|
+
expect.objectContaining({
|
42
|
+
created: expect.any(Date),
|
43
|
+
id: expect.any(Number),
|
44
|
+
name: expect.any(String)
|
45
|
+
})
|
46
|
+
])
|
47
|
+
})
|
48
|
+
})
|
49
|
+
})
|
50
|
+
|
51
|
+
it('getFollowings() returns which users are being followed by the specified user', () => {
|
52
|
+
return getFollowings(55549140).then((res) => {
|
53
|
+
return expect(res).toMatchObject({
|
54
|
+
previousPageCursor: expect.toBeOneOf([expect.any(String), null]),
|
55
|
+
nextPageCursor: expect.toBeOneOf([expect.any(String), null]),
|
56
|
+
data: expect.arrayContaining([
|
57
|
+
expect.objectContaining({
|
58
|
+
created: expect.any(Date),
|
59
|
+
id: expect.any(Number),
|
60
|
+
name: expect.any(String)
|
61
|
+
})
|
62
|
+
])
|
63
|
+
})
|
64
|
+
})
|
65
|
+
})
|
66
|
+
|
67
|
+
it('getFriendRequests() returns the logged in user\'s incoming friend requests', () => {
|
68
|
+
return getFriendRequests().then((res) => {
|
69
|
+
return expect(res).toMatchObject({
|
70
|
+
previousPageCursor: expect.toBeOneOf([expect.any(String), null]),
|
71
|
+
nextPageCursor: expect.toBeOneOf([expect.any(String), null]),
|
72
|
+
data: expect.toBeOneOf([
|
73
|
+
expect.arrayContaining([
|
74
|
+
expect.objectContaining({
|
75
|
+
created: expect.any(Date),
|
76
|
+
id: expect.any(Number),
|
77
|
+
isBanned: expect.any(Boolean),
|
78
|
+
isDeleted: expect.any(Boolean),
|
79
|
+
isOnline: expect.any(Boolean),
|
80
|
+
name: expect.any(String),
|
81
|
+
description: expect.toBeOneOf([expect.any(String), null]),
|
82
|
+
externalAppDisplayName: expect.toBeOneOf([expect.any(String), null]),
|
83
|
+
friendFrequentRank: expect.any(Number),
|
84
|
+
friendFrequentScore: expect.any(Number),
|
85
|
+
hasVerifiedBadge: expect.any(Boolean),
|
86
|
+
presenceType: expect.any(Number),
|
87
|
+
displayName: expect.any(String)
|
88
|
+
})
|
89
|
+
]),
|
90
|
+
expect.not.arrayContaining([expect.any(Object)])
|
91
|
+
])
|
92
|
+
})
|
93
|
+
})
|
94
|
+
})
|
95
|
+
|
96
|
+
it('getFriends() returns the friends of the specified user', () => {
|
97
|
+
return getFriends(64679301).then((res) => {
|
98
|
+
return expect(res).toMatchObject({
|
99
|
+
data: expect.arrayContaining([
|
100
|
+
expect.objectContaining({
|
101
|
+
created: expect.any(Date),
|
102
|
+
id: expect.any(Number),
|
103
|
+
isBanned: expect.any(Boolean),
|
104
|
+
isDeleted: expect.any(Boolean),
|
105
|
+
isOnline: expect.any(Boolean),
|
106
|
+
name: expect.any(String),
|
107
|
+
description: expect.toBeOneOf([expect.any(String), null]),
|
108
|
+
externalAppDisplayName: expect.toBeOneOf([expect.any(String), null]),
|
109
|
+
friendFrequentRank: expect.any(Number),
|
110
|
+
friendFrequentScore: expect.any(Number),
|
111
|
+
hasVerifiedBadge: expect.any(Boolean),
|
112
|
+
displayName: expect.any(String)
|
113
|
+
})
|
114
|
+
])
|
115
|
+
})
|
116
|
+
})
|
117
|
+
})
|
118
|
+
|
119
|
+
it('declineFriendRequest() declines a friend request', async () => {
|
120
|
+
await setCookie(process.env.COOKIE).then(() => {
|
121
|
+
sendFriendRequest(857710783)
|
122
|
+
})
|
123
|
+
|
124
|
+
return setCookie(process.env.COOKIE_2).then(async () => {
|
125
|
+
return await expect(declineFriendRequest(64679301)).resolves.not.toThrow()
|
126
|
+
})
|
127
|
+
})
|
128
|
+
})
|