File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -607,7 +607,7 @@ export default class ProjectsService {
607607 * Create a new material type
608608 * @param name the name of the new material type
609609 * @param submitter the user who is creating the material type
610- * @throws if the submitter is a leader or the material type with given name already exists
610+ * @throws if the submitter is not a leader or the material type with the given name already exists
611611 */
612612 static async createMaterialType ( name : string , submitter : User ) : Promise < Material_Type > {
613613 if ( ! isLeadership ( submitter . role ) ) throw new AccessDeniedAdminOnlyException ( 'create material type' ) ;
Original file line number Diff line number Diff line change @@ -260,16 +260,16 @@ describe('Projects', () => {
260260 ) ;
261261 } ) ;
262262
263- test ( 'Create material type fails if the material type with the given name already exists' ) ,
264- async ( ) => {
265- vi . spyOn ( prisma . material_Type , 'findUnique' ) . mockResolvedValue ( toolMaterial ) ;
263+ test ( 'Create material type fails if the material type with the given name already exists' , async ( ) => {
264+ vi . spyOn ( prisma . material_Type , 'findUnique' ) . mockResolvedValue ( toolMaterial ) ;
266265
267- await expect ( ProjectsService . createMaterialType ( 'NERSoftwareTools' , batman ) ) . rejects . toThrow (
268- new HttpException ( 400 , 'The following material type alraedy exists: NERSoftwareTools' )
269- ) ;
270- } ;
266+ await expect ( ProjectsService . createMaterialType ( 'NERSoftwareTools' , batman ) ) . rejects . toThrow (
267+ new HttpException ( 400 , 'The following material type alraedy exists: NERSoftwareTools' )
268+ ) ;
269+ } ) ;
271270
272271 test ( 'Create material type works' , async ( ) => {
272+ vi . spyOn ( prisma . material_Type , 'findUnique' ) . mockResolvedValue ( null ) ;
273273 vi . spyOn ( prisma . material_Type , 'create' ) . mockResolvedValue ( toolMaterial ) ;
274274
275275 const materialType = await ProjectsService . createMaterialType ( 'NERSoftwareTools' , batman ) ;
You can’t perform that action at this time.
0 commit comments