noblox.ts-fetch 4.6.8
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of noblox.ts-fetch 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,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
|
+
})
|
@@ -0,0 +1,212 @@
|
|
1
|
+
const { addDeveloperProduct, checkDeveloperProductName, getGroupGames, configureGamePass, getGameInstances, getGamePasses, getGameSocialLinks, getUniverseInfo, 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('Game Methods', () => {
|
12
|
+
// let newProductId
|
13
|
+
|
14
|
+
it('addDeveloperProduct() adds a developer product to a universe', () => {
|
15
|
+
return addDeveloperProduct(79354837, `${parseInt(Date.now().toString().slice(-6))} Coins`, 5, 'A hefty sum of cash for you and a successful test for me.').then((res) => {
|
16
|
+
// newProductId = res.productId
|
17
|
+
|
18
|
+
return expect(res).toMatchObject({
|
19
|
+
universeId: 79354837,
|
20
|
+
name: expect.any(String), // account for Roblox filters
|
21
|
+
priceInRobux: 5,
|
22
|
+
description: expect.any(String), // account for Roblox filters
|
23
|
+
productId: expect.any(Number)
|
24
|
+
})
|
25
|
+
})
|
26
|
+
})
|
27
|
+
|
28
|
+
it('checkDeveloperProductName() should return if a developer product name is in use within a universe', () => {
|
29
|
+
return checkDeveloperProductName(79354837, '100 Koins').then((res) => {
|
30
|
+
return expect(res).toMatchObject({
|
31
|
+
Success: expect.any(Boolean),
|
32
|
+
Message: expect.any(String)
|
33
|
+
})
|
34
|
+
})
|
35
|
+
})
|
36
|
+
|
37
|
+
it('configureGamePass() should configure a game pass', () => {
|
38
|
+
const randomString = Date.now().toString().substr(-2)
|
39
|
+
return configureGamePass(13925030, `name${randomString}`, 'random description', parseInt(randomString)).then((res) => {
|
40
|
+
return expect(res).toMatchObject({
|
41
|
+
gamePassId: 13925030,
|
42
|
+
name: `name${randomString}`,
|
43
|
+
description: 'random description',
|
44
|
+
price: parseInt(randomString),
|
45
|
+
isForSale: true,
|
46
|
+
iconChanged: false
|
47
|
+
})
|
48
|
+
})
|
49
|
+
})
|
50
|
+
|
51
|
+
// Broken as of v4.14.0
|
52
|
+
// eslint-disable-next-line jest/no-commented-out-tests
|
53
|
+
// it('getDeveloperProducts() should return developer products, given placeId', () => {
|
54
|
+
// return getDeveloperProducts(166178819).then((res) => {
|
55
|
+
// return expect(res).toMatchObject({
|
56
|
+
// DeveloperProducts: expect.any(Array),
|
57
|
+
// FinalPage: expect.any(Boolean),
|
58
|
+
// PageSize: expect.any(Number)
|
59
|
+
// })
|
60
|
+
// })
|
61
|
+
// })
|
62
|
+
|
63
|
+
it('getGameInstances() should return instances of a game, given placeId', () => {
|
64
|
+
return getGameInstances(142823291, 'Public', 'Asc', 100).then((res) => {
|
65
|
+
return expect(res).toEqual(
|
66
|
+
expect.arrayContaining([
|
67
|
+
expect.objectContaining({
|
68
|
+
id: expect.any(String),
|
69
|
+
maxPlayers: expect.any(Number),
|
70
|
+
playing: expect.any(Number),
|
71
|
+
playerTokens: expect.arrayContaining([
|
72
|
+
expect.any(String)
|
73
|
+
]),
|
74
|
+
fps: expect.any(Number),
|
75
|
+
ping: expect.any(Number)
|
76
|
+
})
|
77
|
+
])
|
78
|
+
)
|
79
|
+
})
|
80
|
+
})
|
81
|
+
|
82
|
+
it('getGamePasses() should return an array of game passes, given universeId', () => {
|
83
|
+
return getGamePasses(2615802125).then((res) => {
|
84
|
+
return expect(res).toEqual(
|
85
|
+
expect.arrayContaining([
|
86
|
+
expect.objectContaining({
|
87
|
+
id: expect.any(Number),
|
88
|
+
name: expect.any(String),
|
89
|
+
displayName: expect.any(String),
|
90
|
+
productId: expect.any(Number),
|
91
|
+
price: expect.any(Number)
|
92
|
+
})
|
93
|
+
])
|
94
|
+
)
|
95
|
+
})
|
96
|
+
})
|
97
|
+
|
98
|
+
it('getGameSocialLinks() should return social link information of a game, given universeId', () => {
|
99
|
+
return getGameSocialLinks(2615802125).then((res) => {
|
100
|
+
return expect(res).toEqual(
|
101
|
+
expect.arrayContaining([
|
102
|
+
expect.objectContaining({
|
103
|
+
id: expect.any(Number),
|
104
|
+
title: expect.any(String),
|
105
|
+
type: expect.any(String),
|
106
|
+
url: expect.any(String)
|
107
|
+
})
|
108
|
+
])
|
109
|
+
)
|
110
|
+
})
|
111
|
+
})
|
112
|
+
|
113
|
+
it('getGroupGames() returns an array of group games', () => {
|
114
|
+
return getGroupGames({ groupId: 9997719, limit: 1 }).then((res) => {
|
115
|
+
return expect(res[0]).toMatchObject({
|
116
|
+
id: expect.any(Number),
|
117
|
+
name: expect.any(String),
|
118
|
+
description: expect.toBeOneOf([expect.any(String), null]),
|
119
|
+
creator: {
|
120
|
+
id: expect.any(Number),
|
121
|
+
type: expect.any(String)
|
122
|
+
},
|
123
|
+
rootPlace: {
|
124
|
+
id: expect.any(Number),
|
125
|
+
type: expect.any(String)
|
126
|
+
},
|
127
|
+
created: expect.any(Date),
|
128
|
+
updated: expect.any(Date),
|
129
|
+
placeVisits: expect.any(Number)
|
130
|
+
})
|
131
|
+
})
|
132
|
+
})
|
133
|
+
|
134
|
+
it('getUniverseInfo() should return information about universes', () => {
|
135
|
+
return getUniverseInfo(2152417643).then((res) => {
|
136
|
+
return expect(res).toEqual(
|
137
|
+
expect.arrayContaining([
|
138
|
+
expect.objectContaining({
|
139
|
+
id: expect.any(Number),
|
140
|
+
rootPlaceId: expect.any(Number),
|
141
|
+
name: expect.any(String),
|
142
|
+
description: expect.any(String),
|
143
|
+
creator: expect.objectContaining({
|
144
|
+
id: expect.any(Number),
|
145
|
+
name: expect.any(String),
|
146
|
+
type: expect.any(String),
|
147
|
+
isRNVAccount: expect.any(Boolean)
|
148
|
+
}),
|
149
|
+
allowedGearGenres: expect.any(Array),
|
150
|
+
allowedGearCategories: expect.any(Array),
|
151
|
+
isGenreEnforced: expect.any(Boolean),
|
152
|
+
copyingAllowed: expect.any(Boolean),
|
153
|
+
playing: expect.any(Number),
|
154
|
+
visits: expect.any(Number),
|
155
|
+
maxPlayers: expect.any(Number),
|
156
|
+
created: expect.any(Date),
|
157
|
+
updated: expect.any(Date),
|
158
|
+
studioAccessToApisAllowed: expect.any(Boolean),
|
159
|
+
createVipServersAllowed: expect.any(Boolean),
|
160
|
+
universeAvatarType: expect.any(String),
|
161
|
+
genre: expect.any(String),
|
162
|
+
isAllGenre: expect.any(Boolean),
|
163
|
+
isFavoritedByUser: expect.any(Boolean),
|
164
|
+
favoritedCount: expect.any(Number)
|
165
|
+
})
|
166
|
+
])
|
167
|
+
)
|
168
|
+
})
|
169
|
+
})
|
170
|
+
|
171
|
+
it('getPlaceInfo() should return an array of information about places', () => {
|
172
|
+
return getPlaceInfo(10905034443).then((res) => {
|
173
|
+
return expect(res).toEqual(
|
174
|
+
expect.arrayContaining([
|
175
|
+
expect.objectContaining({
|
176
|
+
placeId: expect.any(Number),
|
177
|
+
name: expect.any(String),
|
178
|
+
sourceName: expect.any(String),
|
179
|
+
sourceDescription: expect.any(String),
|
180
|
+
url: expect.any(String),
|
181
|
+
builder: expect.any(String),
|
182
|
+
builderId: expect.any(Number),
|
183
|
+
hasVerifiedBadge: expect.any(Boolean),
|
184
|
+
isPlayable: expect.any(Boolean),
|
185
|
+
reasonProhibited: expect.any(String),
|
186
|
+
universeId: expect.any(Number),
|
187
|
+
universeRootPlaceId: expect.any(Number),
|
188
|
+
price: expect.any(Number),
|
189
|
+
imageToken: expect.any(String)
|
190
|
+
})
|
191
|
+
])
|
192
|
+
)
|
193
|
+
})
|
194
|
+
})
|
195
|
+
|
196
|
+
// Dependency on getDeveloperProducts() which is broken as of 4.14.0
|
197
|
+
// eslint-disable-next-line jest/no-commented-out-tests
|
198
|
+
// it('updateDeveloperProduct() should update a developer product with new information', () => {
|
199
|
+
// return getDeveloperProducts(166178819).then((productsData) => {
|
200
|
+
// const developerProduct = productsData.DeveloperProducts.filter((product) => product.ProductId === newProductId)[0]
|
201
|
+
// return updateDeveloperProduct(79354837, developerProduct.DeveloperProductId, `Test${Date.now().toString().slice(-6)}`, 104, 'Currently unit testing.').then((res) => {
|
202
|
+
// return expect(res).toMatchObject({
|
203
|
+
// universeId: 79354837,
|
204
|
+
// name: expect.any(String), // account for Roblox filters
|
205
|
+
// priceInRobux: 104,
|
206
|
+
// description: expect.any(String), // account for Roblox filters
|
207
|
+
// developerProductId: developerProduct.DeveloperProductId
|
208
|
+
// })
|
209
|
+
// })
|
210
|
+
// })
|
211
|
+
// })
|
212
|
+
})
|