File tree Expand file tree Collapse file tree 2 files changed +72
-0
lines changed Expand file tree Collapse file tree 2 files changed +72
-0
lines changed Original file line number Diff line number Diff line change
1
+ export const groups = {
2
+ message : "Roles fetched successfully!" ,
3
+ groups : [
4
+ {
5
+ id : "27EdauP9UmxCTgAMDPpl" ,
6
+ date : {
7
+ _seconds : 1719334613 ,
8
+ _nanoseconds : 934000000 ,
9
+ } ,
10
+ createdBy : "zXQpimWaGWOFF2sLyrFt" ,
11
+ rolename : "group-testing 3" ,
12
+ roleid : "1255205109340573782" ,
13
+ description : "for testing" ,
14
+ memberCount : 0 ,
15
+ isMember : false ,
16
+ } ,
17
+ {
18
+ id : "ELjCeNZxhHupn8qU5pWI" ,
19
+ date : {
20
+ _seconds : 1718771669 ,
21
+ _nanoseconds : 27000000 ,
22
+ } ,
23
+ createdBy : "zXQpimWaGWOFF2sLyrFt" ,
24
+ rolename : "group-testing" ,
25
+ roleid : "1252843931306164298" ,
26
+ description : "for testing" ,
27
+ memberCount : 0 ,
28
+ isMember : false ,
29
+ } ,
30
+ {
31
+ id : "tO4vZe5CC690yOb9Txlh" ,
32
+ date : {
33
+ _seconds : 1718771969 ,
34
+ _nanoseconds : 680000000 ,
35
+ } ,
36
+ createdBy : "zXQpimWaGWOFF2sLyrFt" ,
37
+ rolename : "group-testinge" ,
38
+ roleid : "1252845191472087050" ,
39
+ description : "" ,
40
+ memberCount : 0 ,
41
+ isMember : false ,
42
+ } ,
43
+ ] ,
44
+ } ;
Original file line number Diff line number Diff line change
1
+ import JSONResponse from "../../../src/utils/JsonResponse" ;
2
+ import { groupInvite } from "../../../src/controllers/groupInvite" ;
3
+ import { groups } from "../../fixtures/groups" ;
4
+ import { environment } from "../../fixtures/config" ;
5
+
6
+ describe ( "Test /group-invite command" , ( ) => {
7
+ beforeEach ( ( ) => {
8
+ jest . mock ( "../../src/utils/fetchDiscordGroups" , ( ) => ( {
9
+ fetchDiscordGroups : jest . fn ( ) . mockImplementation ( ( ) => {
10
+ return Promise . resolve ( {
11
+ json : ( ) => Promise . resolve ( groups ) ,
12
+ status : 200 ,
13
+ ok : true ,
14
+ } ) ;
15
+ } ) ,
16
+ } ) ) ;
17
+ } ) ;
18
+
19
+ it ( "Should be an instance of JSONResponse" , async ( ) => {
20
+ const response = await groupInvite (
21
+ "1" ,
22
+ groups . groups [ 0 ] . roleid ,
23
+ environment [ 0 ]
24
+ ) ;
25
+ console . log ( "mock response" , response ) ;
26
+ expect ( response ) . toBeInstanceOf ( JSONResponse ) ;
27
+ } ) ;
28
+ } ) ;
You can’t perform that action at this time.
0 commit comments