noblox.js-middleware 0.0.1-security → 4.6.9

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-middleware might be problematic. Click here for more details.

Files changed (259) hide show
  1. package/.eslintrc.js +21 -0
  2. package/.github/FUNDING.yml +3 -0
  3. package/.github/ISSUE_TEMPLATE/bug_report.md +29 -0
  4. package/.github/ISSUE_TEMPLATE/feature_request.md +22 -0
  5. package/.github/workflows/doc-publish.yml +33 -0
  6. package/.github/workflows/npmpublish.yml +70 -0
  7. package/.travis.yml +13 -0
  8. package/CODE_OF_CONDUCT.md +76 -0
  9. package/LICENSE +21 -0
  10. package/README.md +166 -3
  11. package/examples/cleanPlayers.js +130 -0
  12. package/examples/cleanWall.js +110 -0
  13. package/examples/revertRanks.js +100 -0
  14. package/examples/savePlayers.js +119 -0
  15. package/examples/saveWall.js +96 -0
  16. package/img/moderatedThumbnails/moderatedThumbnail_100x100.png +0 -0
  17. package/img/moderatedThumbnails/moderatedThumbnail_110x110.png +0 -0
  18. package/img/moderatedThumbnails/moderatedThumbnail_140x140.png +0 -0
  19. package/img/moderatedThumbnails/moderatedThumbnail_150x150.png +0 -0
  20. package/img/moderatedThumbnails/moderatedThumbnail_150x200.png +0 -0
  21. package/img/moderatedThumbnails/moderatedThumbnail_180x180.png +0 -0
  22. package/img/moderatedThumbnails/moderatedThumbnail_250x250.png +0 -0
  23. package/img/moderatedThumbnails/moderatedThumbnail_30x30.png +0 -0
  24. package/img/moderatedThumbnails/moderatedThumbnail_352x352.png +0 -0
  25. package/img/moderatedThumbnails/moderatedThumbnail_420x420.png +0 -0
  26. package/img/moderatedThumbnails/moderatedThumbnail_48x48.png +0 -0
  27. package/img/moderatedThumbnails/moderatedThumbnail_50x50.png +0 -0
  28. package/img/moderatedThumbnails/moderatedThumbnail_60x60.png +0 -0
  29. package/img/moderatedThumbnails/moderatedThumbnail_720x720.png +0 -0
  30. package/img/moderatedThumbnails/moderatedThumbnail_75x75.png +0 -0
  31. package/img/noblox-js-small.png +0 -0
  32. package/img/noblox-js.png +0 -0
  33. package/img/thumbnailSizes.png +0 -0
  34. package/jsDocsConfig.json +55 -0
  35. package/lib/accountinformation/getUserSocialLinks.js +42 -0
  36. package/lib/accountsettings/block.js +58 -0
  37. package/lib/accountsettings/unblock.js +58 -0
  38. package/lib/asset/deleteFromInventory.js +69 -0
  39. package/lib/asset/getGamePassProductInfo.js +51 -0
  40. package/lib/asset/getProductInfo.js +56 -0
  41. package/lib/asset/uploadAnimation.js +103 -0
  42. package/lib/asset/uploadItem.js +83 -0
  43. package/lib/asset/uploadModel.js +90 -0
  44. package/lib/avatar/avatarRules.js +38 -0
  45. package/lib/avatar/currentlyWearing.js +32 -0
  46. package/lib/avatar/getAvatar.js +35 -0
  47. package/lib/avatar/getCurrentAvatar.js +37 -0
  48. package/lib/avatar/getRecentItems.js +37 -0
  49. package/lib/avatar/outfitDetails.js +32 -0
  50. package/lib/avatar/outfits.js +37 -0
  51. package/lib/avatar/redrawAvatar.js +48 -0
  52. package/lib/avatar/removeAssetId.js +55 -0
  53. package/lib/avatar/setAvatarBodyColors.js +60 -0
  54. package/lib/avatar/setAvatarScales.js +60 -0
  55. package/lib/avatar/setPlayerAvatarType.js +50 -0
  56. package/lib/avatar/setWearingAssets.js +50 -0
  57. package/lib/avatar/wearAssetId.js +55 -0
  58. package/lib/badges/getAwardedTimestamps.js +52 -0
  59. package/lib/badges/getBadgeInfo.js +43 -0
  60. package/lib/badges/getGameBadges.js +62 -0
  61. package/lib/badges/getPlayerBadges.js +28 -0
  62. package/lib/badges/updateBadgeInfo.js +80 -0
  63. package/lib/cache/add.js +14 -0
  64. package/lib/cache/addIf.js +26 -0
  65. package/lib/cache/clear.js +8 -0
  66. package/lib/cache/get.js +28 -0
  67. package/lib/cache/index.js +17 -0
  68. package/lib/cache/new.js +12 -0
  69. package/lib/cache/wrap.js +25 -0
  70. package/lib/chat/addUsersToConversation.js +61 -0
  71. package/lib/chat/chatSettings.js +33 -0
  72. package/lib/chat/getChatMessages.js +40 -0
  73. package/lib/chat/getConversations.js +43 -0
  74. package/lib/chat/getRolloutSettings.js +35 -0
  75. package/lib/chat/getUnreadConversationCount.js +33 -0
  76. package/lib/chat/getUnreadMessages.js +38 -0
  77. package/lib/chat/getUserConversations.js +37 -0
  78. package/lib/chat/markChatAsRead.js +52 -0
  79. package/lib/chat/markChatAsSeen.js +50 -0
  80. package/lib/chat/multiGetLatestMessages.js +37 -0
  81. package/lib/chat/onNewConversation.js +50 -0
  82. package/lib/chat/onNewMessage.js +53 -0
  83. package/lib/chat/onNewMessageBySelf.js +50 -0
  84. package/lib/chat/onUserOnline.js +50 -0
  85. package/lib/chat/onUserTyping.js +54 -0
  86. package/lib/chat/removeFromGroupConversation.js +62 -0
  87. package/lib/chat/renameGroupConversation.js +57 -0
  88. package/lib/chat/sendChatMessage.js +57 -0
  89. package/lib/chat/setChatUserTyping.js +61 -0
  90. package/lib/chat/start121Conversation.js +50 -0
  91. package/lib/chat/startCloudEditConversation.js +50 -0
  92. package/lib/chat/startGroupConversation.js +62 -0
  93. package/lib/client/onNotification.js +70 -0
  94. package/lib/client/setAPIKey.js +18 -0
  95. package/lib/client/setCookie.js +38 -0
  96. package/lib/datastores/deleteDatastoreEntry.js +66 -0
  97. package/lib/datastores/getDatastoreEntry.js +98 -0
  98. package/lib/datastores/getDatastoreEntryVersions.js +83 -0
  99. package/lib/datastores/getDatastoreKeys.js +73 -0
  100. package/lib/datastores/getDatastores.js +72 -0
  101. package/lib/datastores/incrementDatastoreEntry.js +93 -0
  102. package/lib/datastores/setDatastoreEntry.js +90 -0
  103. package/lib/develop/canManage.js +44 -0
  104. package/lib/develop/configureItem.js +142 -0
  105. package/lib/develop/updateUniverse.js +53 -0
  106. package/lib/develop/updateUniverseAccess.js +55 -0
  107. package/lib/economy/buy.js +99 -0
  108. package/lib/economy/getGroupFunds.js +43 -0
  109. package/lib/economy/getGroupRevenueSummary.js +48 -0
  110. package/lib/economy/getGroupTransactions.js +32 -0
  111. package/lib/economy/getResaleData.js +54 -0
  112. package/lib/economy/getResellers.js +35 -0
  113. package/lib/economy/getUserTransactions.js +34 -0
  114. package/lib/economy/onGroupTransaction.js +74 -0
  115. package/lib/friends/acceptFriendRequest.js +59 -0
  116. package/lib/friends/declineAllFriendRequests.js +57 -0
  117. package/lib/friends/declineFriendRequest.js +59 -0
  118. package/lib/friends/getFollowers.js +61 -0
  119. package/lib/friends/getFollowings.js +61 -0
  120. package/lib/friends/getFriendRequests.js +56 -0
  121. package/lib/friends/getFriends.js +53 -0
  122. package/lib/friends/onFriendRequest.js +58 -0
  123. package/lib/friends/removeFriend.js +58 -0
  124. package/lib/friends/sendFriendRequest.js +59 -0
  125. package/lib/friends/unfollow.js +58 -0
  126. package/lib/games/addDeveloperProduct.js +65 -0
  127. package/lib/games/checkDeveloperProductName.js +39 -0
  128. package/lib/games/configureGamePass.js +146 -0
  129. package/lib/games/getDeveloperProducts.js +51 -0
  130. package/lib/games/getGameInstances.js +31 -0
  131. package/lib/games/getGamePasses.js +39 -0
  132. package/lib/games/getGameRevenue.js +49 -0
  133. package/lib/games/getGameSocialLinks.js +45 -0
  134. package/lib/games/getGroupGames.js +30 -0
  135. package/lib/games/getPlaceInfo.js +48 -0
  136. package/lib/games/getUniverseInfo.js +51 -0
  137. package/lib/games/updateDeveloperProduct.js +69 -0
  138. package/lib/groups/changeRank.js +59 -0
  139. package/lib/groups/deleteWallPost.js +64 -0
  140. package/lib/groups/deleteWallPostsByUser.js +59 -0
  141. package/lib/groups/demote.js +25 -0
  142. package/lib/groups/exile.js +59 -0
  143. package/lib/groups/getAuditLog.js +67 -0
  144. package/lib/groups/getGroup.js +57 -0
  145. package/lib/groups/getGroupSocialLinks.js +44 -0
  146. package/lib/groups/getGroups.js +88 -0
  147. package/lib/groups/getJoinRequest.js +52 -0
  148. package/lib/groups/getJoinRequests.js +58 -0
  149. package/lib/groups/getPlayers.js +108 -0
  150. package/lib/groups/getRankInGroup.js +52 -0
  151. package/lib/groups/getRankNameInGroup.js +52 -0
  152. package/lib/groups/getRole.js +64 -0
  153. package/lib/groups/getRolePermissions.js +51 -0
  154. package/lib/groups/getRoles.js +56 -0
  155. package/lib/groups/getShout.js +49 -0
  156. package/lib/groups/getWall.js +59 -0
  157. package/lib/groups/groupPayout.js +103 -0
  158. package/lib/groups/handleJoinRequest.js +60 -0
  159. package/lib/groups/leaveGroup.js +60 -0
  160. package/lib/groups/onAuditLog.js +62 -0
  161. package/lib/groups/onJoinRequest.js +63 -0
  162. package/lib/groups/onJoinRequestHandle.js +105 -0
  163. package/lib/groups/onShout.js +57 -0
  164. package/lib/groups/onWallPost.js +58 -0
  165. package/lib/groups/promote.js +25 -0
  166. package/lib/groups/searchGroups.js +32 -0
  167. package/lib/groups/setGroupDescription.js +65 -0
  168. package/lib/groups/setGroupName.js +66 -0
  169. package/lib/groups/setRank.js +79 -0
  170. package/lib/groups/shout.js +65 -0
  171. package/lib/index.js +30 -0
  172. package/lib/internal/levelOneCopy.js +16 -0
  173. package/lib/internal/queue.js +61 -0
  174. package/lib/internal/timeout.js +30 -0
  175. package/lib/internal/wrap.js +78 -0
  176. package/lib/inventory/getCollectibles.js +31 -0
  177. package/lib/inventory/getInventory.js +32 -0
  178. package/lib/inventory/getInventoryById.js +31 -0
  179. package/lib/inventory/getOwnership.js +54 -0
  180. package/lib/inventory/getUAIDs.js +47 -0
  181. package/lib/itemconfiguration/getGroupAssets.js +32 -0
  182. package/lib/options.js +26 -0
  183. package/lib/party/onPartyDeleted.js +53 -0
  184. package/lib/party/onPartyInvite.js +53 -0
  185. package/lib/party/onPartyJoinedGame.js +53 -0
  186. package/lib/party/onPartyLeftGame.js +53 -0
  187. package/lib/party/onPartySelfJoined.js +53 -0
  188. package/lib/party/onPartySelfLeft.js +53 -0
  189. package/lib/party/onPartyUserJoined.js +53 -0
  190. package/lib/party/onPartyUserLeft.js +53 -0
  191. package/lib/premiumfeatures/getPremium.js +51 -0
  192. package/lib/presence/getPresences.js +63 -0
  193. package/lib/privatemessages/getMessages.js +60 -0
  194. package/lib/privatemessages/message.js +80 -0
  195. package/lib/privatemessages/onMessage.js +88 -0
  196. package/lib/thumbnails/getLogo.js +60 -0
  197. package/lib/thumbnails/getPlayerThumbnail.js +121 -0
  198. package/lib/thumbnails/getThumbnails.js +93 -0
  199. package/lib/trades/acceptTrade.js +58 -0
  200. package/lib/trades/canTradeWith.js +48 -0
  201. package/lib/trades/counterTrade.js +84 -0
  202. package/lib/trades/declineTrade.js +58 -0
  203. package/lib/trades/getTradeInfo.js +52 -0
  204. package/lib/trades/getTrades.js +37 -0
  205. package/lib/trades/sendTrade.js +82 -0
  206. package/lib/users/getBlurb.js +36 -0
  207. package/lib/users/getIdFromUsername.js +53 -0
  208. package/lib/users/getPlayerInfo.js +100 -0
  209. package/lib/users/getUsernameFromId.js +44 -0
  210. package/lib/users/onBlurbChange.js +46 -0
  211. package/lib/util/clearSession.js +32 -0
  212. package/lib/util/generalRequest.js +61 -0
  213. package/lib/util/getAction.js +45 -0
  214. package/lib/util/getCurrentUser.js +44 -0
  215. package/lib/util/getGeneralToken.js +52 -0
  216. package/lib/util/getHash.js +29 -0
  217. package/lib/util/getInputs.js +37 -0
  218. package/lib/util/getPageResults.js +89 -0
  219. package/lib/util/getSenderUserId.js +30 -0
  220. package/lib/util/getSession.js +38 -0
  221. package/lib/util/getVerification.js +60 -0
  222. package/lib/util/getVerificationInputs.js +31 -0
  223. package/lib/util/http.js +110 -0
  224. package/lib/util/jar.js +24 -0
  225. package/lib/util/refreshCookie.js +52 -0
  226. package/lib/util/relog.js +81 -0
  227. package/lib/util/setOptions.js +54 -0
  228. package/lib/util/shortPoll.js +102 -0
  229. package/lib/util/threaded.js +80 -0
  230. package/package.json +93 -3
  231. package/postinstall.js +1 -0
  232. package/settings.json +107 -0
  233. package/test/accountinformation.test.js +27 -0
  234. package/test/accountsettings.test.js +27 -0
  235. package/test/asset.test.js +81 -0
  236. package/test/assets/Great-White-Shark-Fin.rbxm +0 -0
  237. package/test/assets/KeyframeSequence.rbxm +0 -0
  238. package/test/avatar.test.js +164 -0
  239. package/test/badges.test.js +96 -0
  240. package/test/chat.test.js +104 -0
  241. package/test/datastore.test.js +105 -0
  242. package/test/develop.test.js +53 -0
  243. package/test/economy.test.js +137 -0
  244. package/test/friends.test.js +128 -0
  245. package/test/games.test.js +212 -0
  246. package/test/groups.test.js +311 -0
  247. package/test/inventory.test.js +98 -0
  248. package/test/itemconfiguration.test.js +24 -0
  249. package/test/premiumfeatures.test.js +17 -0
  250. package/test/presence.test.js +25 -0
  251. package/test/privatemessages.test.js +33 -0
  252. package/test/thumbnails.test.js +53 -0
  253. package/test/users.test.js +68 -0
  254. package/tutorials/Authentication.md +75 -0
  255. package/tutorials/Event Emitters.md +26 -0
  256. package/tutorials/Promises.md +86 -0
  257. package/tutorials/VPS Authentication.md +72 -0
  258. package/typings/index.d.ts +2525 -0
  259. 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
+ })