@@ -5,7 +5,6 @@ import { ShortcutParam } from '@/slackTypes';
55import { ActionId , Deadline , Interaction } from '@bot/enums' ;
66import { requestReview } from '@bot/requestReview' ;
77import { languageRepo } from '@repos/languageRepo' ;
8- import { reviewTypesRepo } from '@repos/reviewTypesRepo' ;
98import { App , SlackViewAction , UploadedFile , ViewStateValue } from '@slack/bolt' ;
109import {
1110 buildMockCallbackParam ,
@@ -78,9 +77,6 @@ describe('requestReview', () => {
7877 describe ( 'when no errors occur' , ( ) => {
7978 beforeEach ( async ( ) => {
8079 languageRepo . listAll = jest . fn ( ) . mockResolvedValueOnce ( [ 'Javascript' , 'Go' , 'Other' ] ) ;
81- reviewTypesRepo . listAll = jest
82- . fn ( )
83- . mockResolvedValueOnce ( [ 'HackerRank' , 'Moby Dick Project' ] ) ;
8480
8581 await requestReview . shortcut ( param ) ;
8682 } ) ;
@@ -107,34 +103,10 @@ describe('requestReview', () => {
107103 } ) ;
108104 } ) ;
109105
110- it ( 'should setup the first response block for the review type ' , ( ) => {
106+ it ( 'should setup the first response block for the languages used ' , ( ) => {
111107 const { mock } = param . client . views . open as jest . Mock ;
112108 const blocks = mock . calls [ 0 ] [ 0 ] . view . blocks ;
113109 expect ( blocks [ 0 ] ) . toEqual ( {
114- block_id : ActionId . REVIEW_TYPE ,
115- type : 'input' ,
116- label : {
117- text : 'What type of submission needs reviewed?' ,
118- type : 'plain_text' ,
119- } ,
120- element : {
121- type : 'static_select' ,
122- action_id : ActionId . REVIEW_TYPE ,
123- options : [
124- { text : { text : 'HackerRank' , type : 'plain_text' } , value : 'HackerRank' } ,
125- {
126- text : { text : 'Moby Dick Project' , type : 'plain_text' } ,
127- value : 'Moby Dick Project' ,
128- } ,
129- ] ,
130- } ,
131- } ) ;
132- } ) ;
133-
134- it ( 'should setup the second response block for the languages used' , ( ) => {
135- const { mock } = param . client . views . open as jest . Mock ;
136- const blocks = mock . calls [ 0 ] [ 0 ] . view . blocks ;
137- expect ( blocks [ 1 ] ) . toEqual ( {
138110 block_id : ActionId . LANGUAGE_SELECTIONS ,
139111 type : 'input' ,
140112 label : {
@@ -153,10 +125,10 @@ describe('requestReview', () => {
153125 } ) ;
154126 } ) ;
155127
156- it ( 'should setup the third response block for when the reviews are needed by' , ( ) => {
128+ it ( 'should setup the second response block for when the reviews are needed by' , ( ) => {
157129 const { mock } = param . client . views . open as jest . Mock ;
158130 const blocks = mock . calls [ 0 ] [ 0 ] . view . blocks ;
159- expect ( blocks [ 2 ] ) . toEqual ( {
131+ expect ( blocks [ 1 ] ) . toEqual ( {
160132 block_id : ActionId . REVIEW_DEADLINE ,
161133 type : 'input' ,
162134 label : {
@@ -178,10 +150,10 @@ describe('requestReview', () => {
178150 } ) ;
179151 } ) ;
180152
181- it ( 'should setup the forth response block for the number of reviewers necessary' , ( ) => {
153+ it ( 'should setup the third response block for the number of reviewers necessary' , ( ) => {
182154 const { mock } = param . client . views . open as jest . Mock ;
183155 const blocks = mock . calls [ 0 ] [ 0 ] . view . blocks ;
184- expect ( blocks [ 3 ] ) . toEqual ( {
156+ expect ( blocks [ 2 ] ) . toEqual ( {
185157 block_id : ActionId . NUMBER_OF_REVIEWERS ,
186158 type : 'input' ,
187159 label : {
@@ -200,13 +172,13 @@ describe('requestReview', () => {
200172 it ( 'should default the number of reviewers to 2, the number required for a new hire' , ( ) => {
201173 const { mock } = param . client . views . open as jest . Mock ;
202174 const blocks = mock . calls [ 0 ] [ 0 ] . view . blocks ;
203- expect ( blocks [ 3 ] . element . initial_value ) . toEqual ( '2' ) ;
175+ expect ( blocks [ 2 ] . element . initial_value ) . toEqual ( '2' ) ;
204176 } ) ;
205177
206- it ( 'should setup the sixth response block for the PDF file input' , ( ) => {
178+ it ( 'should setup the fifth response block for the PDF file input' , ( ) => {
207179 const { mock } = param . client . views . open as jest . Mock ;
208180 const blocks = mock . calls [ 0 ] [ 0 ] . view . blocks ;
209- expect ( blocks [ 5 ] ) . toEqual ( {
181+ expect ( blocks [ 4 ] ) . toEqual ( {
210182 type : 'input' ,
211183 block_id : ActionId . PDF_IDENTIFIER ,
212184 label : {
@@ -222,19 +194,16 @@ describe('requestReview', () => {
222194 } ) ;
223195 } ) ;
224196
225- it ( 'should not setup the sixth response block for the PDF file input when HackParser is not enabled' , async ( ) => {
197+ it ( 'should not setup the fifth response block for the PDF file input when HackParser is not enabled' , async ( ) => {
226198 process . env . HACK_PARSER_BUCKET_NAME = '' ;
227199
228200 languageRepo . listAll = jest . fn ( ) . mockResolvedValueOnce ( [ 'Javascript' , 'Go' , 'Other' ] ) ;
229- reviewTypesRepo . listAll = jest
230- . fn ( )
231- . mockResolvedValueOnce ( [ 'HackerRank' , 'Moby Dick Project' ] ) ;
232201
233202 await requestReview . shortcut ( param ) ;
234203
235204 const { mock } = param . client . views . open as jest . Mock ;
236205 const blocks = mock . calls [ 1 ] [ 0 ] . view . blocks ;
237- expect ( blocks [ 5 ] ) . toBeUndefined ( ) ;
206+ expect ( blocks [ 4 ] ) . toBeUndefined ( ) ;
238207 } ) ;
239208 } ) ;
240209
@@ -265,7 +234,6 @@ describe('requestReview', () => {
265234 beforeEach ( async ( ) => {
266235 param . client . views . open = jest . fn ( ) . mockRejectedValueOnce ( 'Dialog failed' ) ;
267236 languageRepo . listAll = jest . fn ( ) . mockResolvedValueOnce ( [ ] ) ;
268- reviewTypesRepo . listAll = jest . fn ( ) . mockResolvedValueOnce ( [ ] ) ;
269237
270238 await requestReview . shortcut ( param ) ;
271239 } ) ;
@@ -313,15 +281,6 @@ describe('requestReview', () => {
313281 } ,
314282 } ,
315283 } ,
316- [ ActionId . REVIEW_TYPE ] : {
317- [ ActionId . REVIEW_TYPE ] : {
318- type : 'static_select' ,
319- selected_option : {
320- text : { type : 'plain_text' , text : 'Moby Dick Project' } ,
321- value : 'Moby Dick Project' ,
322- } ,
323- } ,
324- } ,
325284 [ ActionId . NUMBER_OF_REVIEWERS ] : {
326285 [ ActionId . NUMBER_OF_REVIEWERS ] : {
327286 type : 'plain_text_input' ,
@@ -400,7 +359,7 @@ describe('requestReview', () => {
400359 expect ( param . client . chat . postMessage ) . toBeCalledWith ( {
401360 channel : 'some-channel-id' ,
402361 text : `
403- <@${ param . body . user . id } > has requested 1 reviews for a Moby Dick Project done in the following languages:
362+ <@${ param . body . user . id } > has requested 1 reviews for a HackerRank done in the following languages:
404363
405364 • Go
406365 • Javascript
@@ -427,7 +386,6 @@ _Candidate Identifier: some-identifier_
427386 languages : [ 'Go' , 'Javascript' ] ,
428387 requestedAt : expect . any ( Date ) ,
429388 dueBy : Deadline . MONDAY ,
430- reviewType : 'Moby Dick Project' ,
431389 candidateIdentifier : 'some-identifier' ,
432390 reviewersNeededCount : '1' ,
433391 acceptedReviewers : [ ] ,
0 commit comments