noblox.ts 4.10.5

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 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 +168 -0
  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 +94 -0
  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,311 @@
1
+ const { changeRank, demote, getAuditLog, getGroup, getGroups, getGroupSocialLinks, getJoinRequests, getPlayers, getRankInGroup, getRankNameInGroup, getRole, getRolePermissions, getRoles, getShout, getWall, promote, searchGroups, setRank, shout, 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('Groups Methods', () => {
12
+ it('changeRank() changes rank of a user', () => {
13
+ return changeRank(4591072, 857710783, 1).then((res) => {
14
+ setTimeout(async () => {
15
+ await changeRank(4591072, 857710783, -1)
16
+ }, 1000)
17
+ return expect(res).toMatchObject({
18
+ newRole: expect.any(Object),
19
+ oldRole: expect.any(Object)
20
+ })
21
+ })
22
+ })
23
+
24
+ it('promote() promotes a user', () => {
25
+ return promote(4591072, 857710783).then((res) => {
26
+ return expect(res).toMatchObject({
27
+ newRole: expect.objectContaining({
28
+ name: expect.any(String),
29
+ rank: expect.any(Number),
30
+ id: expect.any(Number)
31
+ }),
32
+ oldRole: expect.objectContaining({
33
+ name: expect.any(String),
34
+ rank: expect.any(Number),
35
+ id: expect.any(Number)
36
+ })
37
+ })
38
+ })
39
+ })
40
+
41
+ it('demote() demotes a user', () => {
42
+ return demote(4591072, 857710783).then((res) => {
43
+ return expect(res).toMatchObject({
44
+ newRole: expect.objectContaining({
45
+ name: expect.any(String),
46
+ rank: expect.any(Number),
47
+ id: expect.any(Number)
48
+ }),
49
+ oldRole: expect.objectContaining({
50
+ name: expect.any(String),
51
+ rank: expect.any(Number),
52
+ id: expect.any(Number)
53
+ })
54
+ })
55
+ })
56
+ })
57
+
58
+ it('getAuditLog() returns a group\'s audit logs', () => {
59
+ return getAuditLog({ group: 4591072, limit: 10 }).then(res => {
60
+ return expect(res).toMatchObject({
61
+ previousPageCursor: expect.toBeOneOf([expect.any(String), null]),
62
+ nextPageCursor: expect.toBeOneOf([expect.any(String), null]),
63
+ data: expect.arrayContaining([
64
+ expect.objectContaining({
65
+ actor: expect.objectContaining({
66
+ user: expect.objectContaining({
67
+ hasVerifiedBadge: expect.any(Boolean),
68
+ userId: expect.any(Number),
69
+ username: expect.any(String),
70
+ displayName: expect.any(String)
71
+ }),
72
+ role: expect.objectContaining({
73
+ id: expect.any(Number),
74
+ name: expect.any(String),
75
+ rank: expect.any(Number)
76
+ })
77
+ }),
78
+ actionType: expect.any(String),
79
+ description: expect.any(Object),
80
+ created: expect.any(Date)
81
+ })
82
+ ])
83
+ })
84
+ })
85
+ })
86
+
87
+ it('getGroup() returns information on a group', () => {
88
+ return getGroup(4591072).then((res) => {
89
+ return expect(res).toMatchObject({
90
+ id: expect.any(Number),
91
+ name: expect.any(String),
92
+ description: expect.any(String),
93
+ owner: {
94
+ userId: expect.any(Number),
95
+ username: expect.any(String),
96
+ hasVerifiedBadge: expect.any(Boolean),
97
+ displayName: expect.any(String)
98
+ },
99
+ shout: expect.objectContaining({
100
+ body: expect.any(String),
101
+ poster: expect.objectContaining({
102
+ hasVerifiedBadge: expect.any(Boolean),
103
+ userId: expect.any(Number),
104
+ username: expect.any(String),
105
+ displayName: expect.any(String)
106
+ }),
107
+ created: expect.any(Date),
108
+ updated: expect.any(Date)
109
+ }),
110
+ memberCount: expect.any(Number),
111
+ isBuildersClubOnly: expect.any(Boolean),
112
+ publicEntryAllowed: expect.any(Boolean),
113
+ hasVerifiedBadge: expect.any(Boolean)
114
+ })
115
+ })
116
+ })
117
+
118
+ it('getGroups() should return groups the specified user is in', async () => {
119
+ return getGroups(55549140).then((res) => {
120
+ return expect(res).toEqual(
121
+ expect.arrayContaining([
122
+ expect.objectContaining({
123
+ Id: expect.any(Number),
124
+ Name: expect.any(String),
125
+ EmblemUrl: expect.any(String),
126
+ MemberCount: expect.any(Number),
127
+ Rank: expect.any(Number),
128
+ Role: expect.any(String),
129
+ RoleId: expect.any(Number),
130
+ IsPrimary: expect.any(Boolean)
131
+ })
132
+ ])
133
+ )
134
+ })
135
+ })
136
+
137
+ it('getGroupSocialLinks() should return social link information of a game, given universeId', () => {
138
+ return getGroupSocialLinks(9997719).then((res) => {
139
+ return expect(res).toEqual(
140
+ expect.arrayContaining([
141
+ expect.objectContaining({
142
+ id: expect.any(Number),
143
+ title: expect.any(String),
144
+ type: expect.any(String),
145
+ url: expect.any(String)
146
+ })
147
+ ])
148
+ )
149
+ })
150
+ })
151
+
152
+ // TODO: getJoinRequest, would require being able to request to join a group
153
+
154
+ it('getJoinRequests() returns a list of players that want to join a group', () => {
155
+ return getJoinRequests(4591072).then((res) => {
156
+ return expect(res).toMatchObject({
157
+ previousPageCursor: expect.toBeOneOf([expect.any(String), null]),
158
+ nextPageCursor: expect.toBeOneOf([expect.any(String), null]),
159
+ data: expect.any(Array)
160
+ })
161
+ })
162
+ })
163
+
164
+ it('getPlayers() returns a list of players in a group', () => {
165
+ return getPlayers(4591072, [30820744]).then((res) => {
166
+ return expect(res).toEqual(
167
+ expect.arrayContaining([
168
+ expect.objectContaining({
169
+ userId: expect.any(Number),
170
+ username: expect.any(String)
171
+ })
172
+ ])
173
+ )
174
+ })
175
+ })
176
+
177
+ it('getRankInGroup() returns a number reflecting a user\'s rank in a group (0-255)', () => {
178
+ return getRankInGroup(4591072, 55549140).then((res) => {
179
+ return expect(res).toEqual(expect.any(Number))
180
+ })
181
+ })
182
+
183
+ it('getRankNameInGroup() returns a number reflecting a user\'s rank name in a group', () => {
184
+ return getRankNameInGroup(4591072, 55549140).then((res) => {
185
+ return expect(res).toEqual(expect.any(String))
186
+ })
187
+ })
188
+
189
+ it('getRole() returns a role that matches the provided rank', () => {
190
+ return getRole(4591072, 255).then((res) => {
191
+ return expect(res).toMatchObject({
192
+ name: expect.any(String),
193
+ rank: expect.any(Number),
194
+ memberCount: expect.any(Number),
195
+ ID: expect.any(Number)
196
+ })
197
+ })
198
+ })
199
+
200
+ it('getRolePermissions() returns permissions given to a role by a group', () => {
201
+ return getRolePermissions(4591072, 30820744).then((res) => {
202
+ return expect(res).toMatchObject({
203
+ groupId: expect.any(Number),
204
+ role: expect.any(Object),
205
+ permissions: expect.any(Object)
206
+ })
207
+ })
208
+ })
209
+
210
+ it('getRoles() returns the roles in a group', () => {
211
+ return getRoles(4591072).then((res) => {
212
+ return expect(res).toEqual(
213
+ expect.arrayContaining([
214
+ expect.objectContaining({
215
+ name: expect.any(String),
216
+ rank: expect.any(Number),
217
+ memberCount: expect.any(Number),
218
+ ID: expect.any(Number)
219
+ })
220
+ ])
221
+ )
222
+ })
223
+ })
224
+
225
+ it('getShout() returns the current shout on a group', () => {
226
+ return getShout(4591072).then((res) => {
227
+ return expect(res).toMatchObject({
228
+ body: expect.any(String),
229
+ poster: {
230
+ userId: expect.any(Number),
231
+ username: expect.any(String)
232
+ },
233
+ created: expect.any(String),
234
+ updated: expect.any(String)
235
+ })
236
+ })
237
+ })
238
+
239
+ it('getWall() returns the latest messages on the group wall', () => {
240
+ return getWall(4591072).then((res) => {
241
+ return expect(res).toMatchObject({
242
+ previousPageCursor: expect.toBeOneOf([expect.any(String), null]),
243
+ nextPageCursor: expect.toBeOneOf([expect.any(String), null]),
244
+ data: expect.arrayContaining([
245
+ expect.objectContaining({
246
+ id: expect.any(Number),
247
+ poster: expect.toBeOneOf([expect.any(Object), null]),
248
+ body: expect.any(String),
249
+ created: expect.any(Date),
250
+ updated: expect.any(Date)
251
+ })
252
+ ])
253
+ })
254
+ })
255
+ })
256
+
257
+ // PASS: groupPayout, costs Robux to test
258
+
259
+ // PASS: handleJoinRequest, would require being able to request to join a group
260
+
261
+ // PASS: leaveGroup, would require being able to request to join a group
262
+
263
+ it('searchGroups() returns groups that match the query', () => {
264
+ return searchGroups('noblox.js').then((res) => {
265
+ return expect(res).toEqual(
266
+ expect.arrayContaining([expect.objectContaining({
267
+ id: expect.any(Number),
268
+ name: expect.any(String),
269
+ description: expect.any(String),
270
+ memberCount: expect.any(Number),
271
+ publicEntryAllowed: expect.any(Boolean),
272
+ created: expect.any(Date),
273
+ updated: expect.any(Date)
274
+ })]))
275
+ })
276
+ })
277
+
278
+ // PASS: setGroupDescription -- skip this, do not own group
279
+
280
+ // PASS: setGroupName -- skip this, costs Robux
281
+
282
+ it('setRank() should set a player\'s rank to the specified rank', () => {
283
+ return changeRank(4591072, 857710783, 2).then(() => {
284
+ return setRank(4591072, 857710783, 1).then((res) => {
285
+ return expect(res).toMatchObject({
286
+ name: expect.any(String),
287
+ rank: expect.any(Number),
288
+ memberCount: expect.any(Number),
289
+ ID: expect.any(Number)
290
+ })
291
+ })
292
+ })
293
+ })
294
+
295
+ it('shout() should post a message to the group\'s shout', () => {
296
+ return shout(4591072, 'This is a noblox.js test!').then((res) => {
297
+ setTimeout(async () => {
298
+ await shout(4591072, '')
299
+ }, 1000)
300
+ return expect(res).toMatchObject({
301
+ body: expect.any(String),
302
+ poster: {
303
+ userId: expect.any(Number),
304
+ username: expect.any(String)
305
+ },
306
+ created: expect.any(String),
307
+ updated: expect.any(String)
308
+ })
309
+ })
310
+ })
311
+ })
@@ -0,0 +1,98 @@
1
+ const { getCollectibles, getInventory, getInventoryById, getOwnership, getUAIDs, 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('Inventory Methods', () => {
12
+ it('getCollectibles() should return a user\'s collectibles.', async () => {
13
+ return getCollectibles(55549140).then((res) => {
14
+ return expect(res).toEqual(
15
+ expect.arrayContaining([
16
+ expect.objectContaining({
17
+ userAssetId: expect.any(Number),
18
+ serialNumber: expect.toBeOneOf([expect.any(Number), null]),
19
+ assetId: expect.any(Number),
20
+ name: expect.any(String),
21
+ recentAveragePrice: expect.any(Number),
22
+ originalPrice: expect.toBeOneOf([expect.any(Number), null]),
23
+ assetStock: expect.toBeOneOf([expect.any(Number), null]),
24
+ buildersClubMembershipType: expect.any(Number)
25
+ })
26
+ ])
27
+ )
28
+ })
29
+ })
30
+
31
+ it('getInventory() returns a user\'s inventory', () => {
32
+ return getInventory(55549140, ['Shirt']).then((res) => {
33
+ return expect(res).toEqual(
34
+ expect.arrayContaining([
35
+ expect.objectContaining({
36
+ assetId: expect.any(Number),
37
+ name: expect.any(String),
38
+ assetType: expect.any(String),
39
+ created: expect.any(Date)
40
+ })
41
+ ])
42
+ )
43
+ })
44
+ })
45
+
46
+ it('getInventoryById() returns items in a user\'s inventory fitting the specified assetTypeId', () => {
47
+ return getInventoryById(55549140, 8).then((res) => {
48
+ return expect(res).toEqual(
49
+ expect.arrayContaining([
50
+ expect.objectContaining({
51
+ assetName: expect.any(String),
52
+ userAssetId: expect.any(Number),
53
+ assetId: expect.any(Number),
54
+ owner: expect.objectContaining({
55
+ userId: expect.any(Number),
56
+ username: expect.any(String)
57
+ }),
58
+ created: expect.any(Date),
59
+ updated: expect.any(Date)
60
+ })
61
+ ])
62
+ )
63
+ })
64
+ })
65
+
66
+ it('getOwnership() [ASSET] returns if a player owns the specified asset', () => {
67
+ return getOwnership(55549140, 1900419889).then((res) => {
68
+ return expect(res).toBe(true)
69
+ })
70
+ })
71
+
72
+ it('getOwnership() [GAMEPASS] returns if a player owns the specified game pass', () => {
73
+ return getOwnership(55549140, 1537467, 'GamePass').then((res) => {
74
+ return expect(res).toBe(true)
75
+ })
76
+ })
77
+
78
+ it('getOwnership() [BADGE] returns if a player owns the specified badge', () => {
79
+ return getOwnership(55549140, 176332932, 'Badge').then((res) => {
80
+ return expect(res).toBe(true)
81
+ })
82
+ })
83
+
84
+ it('getOwnership() [BUNDLE] returns if a player owns the specified bundle', () => {
85
+ return getOwnership(55549140, 79, 'Bundle').then((res) => {
86
+ return expect(res).toBe(true)
87
+ })
88
+ })
89
+
90
+ it('getUAIDs() returns a user specific asset IDs given an ID', () => {
91
+ return getUAIDs(80231025, [1974901902, 4255053867, 2705893733, 1532395]).then((res) => {
92
+ return expect(res).toMatchObject({
93
+ uaids: expect.any(Array),
94
+ failedIds: expect.any(Array)
95
+ })
96
+ })
97
+ })
98
+ })
@@ -0,0 +1,24 @@
1
+ const { getGroupAssets, 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('Item Configuration Methods', () => {
12
+ it('getGroupAssets() returns an array of group assets', () => {
13
+ return getGroupAssets({ groupId: 4591072, assetType: 'Shirt', limit: 1 }).then((res) => {
14
+ return expect(res).toEqual(
15
+ expect.arrayContaining([
16
+ expect.objectContaining({
17
+ assetId: expect.any(Number),
18
+ name: expect.any(String)
19
+ })
20
+ ])
21
+ )
22
+ })
23
+ })
24
+ })
@@ -0,0 +1,17 @@
1
+ const { getPremium, 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('Premium Features Methods', () => {
12
+ it('getPremium() returns a player\'s premium state', () => {
13
+ return getPremium(55549140).then((res) => {
14
+ return expect(res).toEqual(expect.any(Boolean))
15
+ })
16
+ })
17
+ })
@@ -0,0 +1,25 @@
1
+ const { getPresences, 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('Presence Methods', () => {
12
+ it('getPresences() returns presences of the userIds provided', () => {
13
+ return getPresences([55549140]).then((res) => {
14
+ return expect(res).toMatchObject({
15
+ userPresences: expect.arrayContaining([
16
+ expect.objectContaining({
17
+ userPresenceType: expect.any(Number),
18
+ userId: expect.any(Number),
19
+ lastOnline: expect.any(String)
20
+ })
21
+ ])
22
+ })
23
+ })
24
+ })
25
+ })
@@ -0,0 +1,33 @@
1
+ const { getMessages, 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('Private Messages Methods', () => {
12
+ it('getMessages() returns the logged in user\'s messages', () => {
13
+ return getMessages().then((res) => {
14
+ return expect(res).toMatchObject({
15
+ totalCollectionSize: expect.any(Number),
16
+ totalPages: expect.any(Number),
17
+ pageNumber: expect.any(Number),
18
+ collection: expect.arrayContaining([
19
+ expect.objectContaining({
20
+ id: expect.any(Number),
21
+ sender: expect.any(Object),
22
+ recipient: expect.any(Object),
23
+ subject: expect.any(String),
24
+ body: expect.any(String),
25
+ created: expect.any(String),
26
+ updated: expect.any(String),
27
+ isRead: expect.any(Boolean)
28
+ })
29
+ ])
30
+ })
31
+ })
32
+ })
33
+ })
@@ -0,0 +1,53 @@
1
+ const { getLogo, getPlayerThumbnail, getThumbnails, 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('Thumbnails Methods', () => {
12
+ it('getLogo() returns a image URL for a group', () => {
13
+ return getLogo(4591072).then(() => {
14
+ return expect.any(String)
15
+ })
16
+ })
17
+
18
+ it('getPlayerThumbnail() returns a player\'s thumbnail', () => {
19
+ return getPlayerThumbnail(55549140, 60).then((res) => {
20
+ return expect(res).toEqual(
21
+ expect.arrayContaining([
22
+ expect.objectContaining({
23
+ targetId: expect.any(Number),
24
+ state: expect.any(String),
25
+ imageUrl: expect.any(String)
26
+ })
27
+ ])
28
+ )
29
+ })
30
+ })
31
+
32
+ it('getThumbnails() returns player/asset thumbnails', () => {
33
+ return getThumbnails([
34
+ {
35
+ type: 'AvatarHeadShot',
36
+ token: '4C32C300ABC60ABD344ABCFB3841E778',
37
+ size: '150x150'
38
+ }
39
+ ]).then((res) => {
40
+ return expect(res).toEqual(
41
+ expect.arrayContaining([
42
+ expect.objectContaining({
43
+ errorCode: expect.any(Number),
44
+ errorMessage: expect.any(String),
45
+ targetId: expect.any(Number),
46
+ state: expect.any(String),
47
+ imageUrl: expect.any(String)
48
+ })
49
+ ])
50
+ )
51
+ })
52
+ })
53
+ })
@@ -0,0 +1,68 @@
1
+ const { getBlurb, getIdFromUsername, getPlayerInfo, getUsernameFromId, 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('Users Methods', () => {
12
+ it('getBlurb() returns a user\'s blurb', () => {
13
+ return getBlurb(55549140).then((res) => {
14
+ return expect(res).toEqual(expect.any(String))
15
+ })
16
+ })
17
+
18
+ it('getIdFromUsername() returns a user\'s ID given their username', () => {
19
+ return getIdFromUsername('ROBLOX').then((res) => {
20
+ return expect(res).toEqual(expect.any(Number))
21
+ })
22
+ })
23
+
24
+ it('getIdFromUsername() returns several IDs given several usernames', () => {
25
+ return getIdFromUsername(['qxest', 'builderman']).then((res) => {
26
+ return expect(res).toEqual(
27
+ expect.arrayContaining([expect.toBeOneOf([expect.any(Number), null])])
28
+ )
29
+ })
30
+ })
31
+
32
+ it('getIdFromUsername() returns null when given username that doesn\'t exist', () => {
33
+ return getIdFromUsername('x').then((res) => {
34
+ return expect(res).toBeNull()
35
+ })
36
+ })
37
+
38
+ it('getIdFromUsername() returns null when given usernames that don\'t exist', () => {
39
+ return getIdFromUsername(['p', 'a']).then((res) => {
40
+ return expect(res).toEqual(
41
+ expect.arrayContaining([null])
42
+ )
43
+ })
44
+ })
45
+
46
+ it('getPlayerInfo() returns information on the specified user', () => {
47
+ return getPlayerInfo(55549140).then((res) => {
48
+ return expect(res).toMatchObject({
49
+ username: expect.any(String),
50
+ blurb: expect.any(String),
51
+ joinDate: expect.any(Date),
52
+ age: expect.any(Number),
53
+ friendCount: expect.any(Number),
54
+ followerCount: expect.any(Number),
55
+ followingCount: expect.any(Number),
56
+ oldNames: expect.any(Array),
57
+ isBanned: expect.any(Boolean),
58
+ displayName: expect.any(String)
59
+ })
60
+ })
61
+ })
62
+
63
+ it('getUsernameFromId() returns a player\'s username given an ID', () => {
64
+ return getUsernameFromId(1).then((res) => {
65
+ return expect(res).toEqual(expect.any(String))
66
+ })
67
+ })
68
+ })