Skip to content

Commit c7aac4d

Browse files
committed
#1522: fixed the typo and test
1 parent 0b47408 commit c7aac4d

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

src/backend/src/services/projects.services.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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');

src/backend/tests/projects.test.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff 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);

0 commit comments

Comments
 (0)