mirror of
				https://github.com/strapi/strapi.git
				synced 2025-10-31 18:08:11 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			69 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			69 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| 'use strict';
 | |
| 
 | |
| const fs = require('fs');
 | |
| const path = require('path');
 | |
| 
 | |
| const { createStrapiInstance } = require('api-tests/strapi');
 | |
| const { createAuthRequest } = require('api-tests/request');
 | |
| 
 | |
| describe('Project settings', () => {
 | |
|   let rq;
 | |
|   let strapi;
 | |
| 
 | |
|   beforeAll(async () => {
 | |
|     strapi = await createStrapiInstance();
 | |
|     rq = await createAuthRequest({ strapi });
 | |
|   });
 | |
| 
 | |
|   afterAll(async () => {
 | |
|     await strapi.destroy();
 | |
|   });
 | |
| 
 | |
|   describe('Menu Logo', () => {
 | |
|     test('Upload a new logo', async () => {
 | |
|       const res = await rq({
 | |
|         url: '/admin/project-settings',
 | |
|         method: 'POST',
 | |
|         formData: { menuLogo: fs.createReadStream(path.join(__dirname, './utils/logo.png')) },
 | |
|       });
 | |
| 
 | |
|       expect(res.status).toBe(200);
 | |
| 
 | |
|       const getRes = await rq({
 | |
|         url: '/admin/project-settings',
 | |
|         method: 'GET',
 | |
|       });
 | |
| 
 | |
|       expect(getRes.body).toMatchObject({
 | |
|         menuLogo: {
 | |
|           ext: '.png',
 | |
|           height: 35,
 | |
|           name: 'logo.png',
 | |
|           size: 1.06,
 | |
|           url: expect.anything(),
 | |
|           width: 35,
 | |
|         },
 | |
|       });
 | |
|     });
 | |
| 
 | |
|     test('Reset to Strapi logo', async () => {
 | |
|       const postRes = await rq({
 | |
|         url: '/admin/project-settings',
 | |
|         method: 'POST',
 | |
|         formData: { menuLogo: 'null' },
 | |
|       });
 | |
| 
 | |
|       expect(postRes.status).toBe(200);
 | |
| 
 | |
|       const getRes = await rq({
 | |
|         url: '/admin/project-settings',
 | |
|         method: 'GET',
 | |
|       });
 | |
| 
 | |
|       expect(getRes.body).toMatchObject({
 | |
|         menuLogo: null,
 | |
|       });
 | |
|     });
 | |
|   });
 | |
| });
 | 
