@@ -42,46 +42,6 @@ describe('Organization Tests', () => {
4242 } ) ;
4343 } ) ;
4444
45- describe ( 'Set Images' , ( ) => {
46- const file1 = { originalname : 'image1.png' } as Express . Multer . File ;
47- const file2 = { originalname : 'image2.png' } as Express . Multer . File ;
48- const file3 = { originalname : 'image3.png' } as Express . Multer . File ;
49- it ( 'Fails if user is not an admin' , async ( ) => {
50- await expect (
51- OrganizationsService . setImages ( file1 , file2 , await createTestUser ( wonderwomanGuest , orgId ) , organization )
52- ) . rejects . toThrow ( new AccessDeniedAdminOnlyException ( 'update images' ) ) ;
53- } ) ;
54-
55- it ( 'Succeeds and updates all the images' , async ( ) => {
56- const testBatman = await createTestUser ( batmanAppAdmin , orgId ) ;
57- ( uploadFile as Mock ) . mockImplementation ( ( file ) => {
58- return Promise . resolve ( { name : `${ file . originalname } ` , id : `uploaded-${ file . originalname } ` } ) ;
59- } ) ;
60-
61- await OrganizationsService . setImages ( file1 , file2 , testBatman , organization ) ;
62-
63- const oldOrganization = await prisma . organization . findUnique ( {
64- where : {
65- organizationId : orgId
66- }
67- } ) ;
68-
69- expect ( oldOrganization ) . not . toBeNull ( ) ;
70- expect ( oldOrganization ?. applyInterestImageId ) . toBe ( 'uploaded-image1.png' ) ;
71- expect ( oldOrganization ?. exploreAsGuestImageId ) . toBe ( 'uploaded-image2.png' ) ;
72-
73- await OrganizationsService . setImages ( file1 , file3 , testBatman , organization ) ;
74-
75- const updatedOrganization = await prisma . organization . findUnique ( {
76- where : {
77- organizationId : orgId
78- }
79- } ) ;
80-
81- expect ( updatedOrganization ?. exploreAsGuestImageId ) . toBe ( 'uploaded-image3.png' ) ;
82- } ) ;
83- } ) ;
84-
8545 describe ( 'Set Useful Links' , ( ) => {
8646 it ( 'Fails if user is not an admin' , async ( ) => {
8747 await expect (
@@ -204,30 +164,6 @@ describe('Organization Tests', () => {
204164 } ) ;
205165 } ) ;
206166
207- describe ( 'Get Organization Images' , ( ) => {
208- it ( 'Fails if an organization does not exist' , async ( ) => {
209- await expect ( async ( ) => await OrganizationsService . getOrganizationImages ( '1' ) ) . rejects . toThrow (
210- new NotFoundException ( 'Organization' , '1' )
211- ) ;
212- } ) ;
213-
214- it ( 'Succeeds and gets all the images' , async ( ) => {
215- const testBatman = await createTestUser ( batmanAppAdmin , orgId ) ;
216- await createTestLinkType ( testBatman , orgId ) ;
217- await OrganizationsService . setImages (
218- { originalname : 'image1.png' } as Express . Multer . File ,
219- { originalname : 'image2.png' } as Express . Multer . File ,
220- testBatman ,
221- organization
222- ) ;
223- const images = await OrganizationsService . getOrganizationImages ( orgId ) ;
224-
225- expect ( images ) . not . toBeNull ( ) ;
226- expect ( images . applyInterestImage ) . toBe ( 'uploaded-image1.png' ) ;
227- expect ( images . exploreAsGuestImage ) . toBe ( 'uploaded-image2.png' ) ;
228- } ) ;
229- } ) ;
230-
231167 describe ( 'Set Logo' , ( ) => {
232168 const file1 = { originalname : 'image1.png' } as Express . Multer . File ;
233169 const file2 = { originalname : 'image2.png' } as Express . Multer . File ;
0 commit comments