@@ -22,26 +22,26 @@ createCourseToDatabase.mockImplementation(() => {return { name: "nickname", id:
22
22
const { defaultTeacherInteraction, defaultStudentInteraction } = require ( "../../mocks/mockInteraction" ) ;
23
23
24
24
beforeEach ( ( ) => {
25
- defaultTeacherInteraction . options = {
26
- getString : jest . fn ( ( name ) => {
27
- const names = {
28
- coursecode : "TKT-100" ,
29
- full_name : "Long course name" ,
30
- nick_name : "nickname" ,
31
- } ;
32
- return names [ name ] ;
33
- } ) ,
34
- } ;
25
+ defaultTeacherInteraction . options = {
26
+ getString : jest . fn ( ( name ) => {
27
+ const names = {
28
+ coursecode : "TKT-100" ,
29
+ full_name : "Long course name" ,
30
+ nick_name : "nickname" ,
31
+ } ;
32
+ return names [ name ] ;
33
+ } ) ,
34
+ } ;
35
35
36
- defaultStudentInteraction . options = {
37
- getString : jest . fn ( ( name ) => {
38
- const names = {
39
- coursecode : "TKT-100" ,
40
- full_name : "Long course name" ,
41
- } ;
42
- return names [ name ] ;
43
- } ) ,
44
- } ;
36
+ defaultStudentInteraction . options = {
37
+ getString : jest . fn ( ( name ) => {
38
+ const names = {
39
+ coursecode : "TKT-100" ,
40
+ full_name : "Long course name" ,
41
+ } ;
42
+ return names [ name ] ;
43
+ } ) ,
44
+ } ;
45
45
} ) ;
46
46
afterEach ( ( ) => {
47
47
jest . clearAllMocks ( ) ;
@@ -67,7 +67,7 @@ describe("slash create command", () => {
67
67
} ) ;
68
68
69
69
test ( "course code must be unique when nickname not given" , async ( ) => {
70
- defaultTeacherInteraction . options = {
70
+ defaultTeacherInteraction . options = {
71
71
getString : jest . fn ( ( name ) => {
72
72
const names = {
73
73
coursecode : "TKT-100" ,
@@ -86,7 +86,7 @@ defaultTeacherInteraction.options = {
86
86
} ) ;
87
87
88
88
test ( "create course name without nick" , async ( ) => {
89
- defaultTeacherInteraction . options = {
89
+ defaultTeacherInteraction . options = {
90
90
getString : jest . fn ( ( name ) => {
91
91
const names = {
92
92
coursecode : "TKT-100" ,
@@ -160,4 +160,11 @@ defaultTeacherInteraction.options = {
160
160
expect ( sendErrorEphemeral ) . toHaveBeenCalledWith ( defaultTeacherInteraction , "Emojis are not allowed!" ) ;
161
161
} ) ;
162
162
163
+ test ( "a student cannot use faculty command" , async ( ) => {
164
+ const client = defaultStudentInteraction . client ;
165
+ const response = "You do not have permission to use this command." ;
166
+ await execute ( defaultStudentInteraction , client , models ) ;
167
+ expect ( sendErrorEphemeral ) . toHaveBeenCalledTimes ( 1 ) ;
168
+ expect ( sendErrorEphemeral ) . toHaveBeenCalledWith ( defaultStudentInteraction , response ) ;
169
+ } ) ;
163
170
} ) ;
0 commit comments