mirror of
				https://github.com/lingble/chatwoot.git
				synced 2025-10-30 18:47:51 +00:00 
			
		
		
		
	 9de8c27368
			
		
	
	9de8c27368
	
	
	
		
			
			Due to the pattern `**/specs/*.spec.js` defined in CircleCI, none of the frontend spec in the folders such as `specs/<domain-name>/getters.spec.js` were not executed in Circle CI. This PR fixes the issue, along with the following changes: - Use vitest instead of jest - Remove jest dependancies - Update tests to work with vitest --------- Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com>
		
			
				
	
	
		
			39 lines
		
	
	
		
			951 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			39 lines
		
	
	
		
			951 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| import agents from '../agents';
 | |
| import ApiClient from '../ApiClient';
 | |
| 
 | |
| describe('#AgentAPI', () => {
 | |
|   it('creates correct instance', () => {
 | |
|     expect(agents).toBeInstanceOf(ApiClient);
 | |
|     expect(agents).toHaveProperty('get');
 | |
|     expect(agents).toHaveProperty('show');
 | |
|     expect(agents).toHaveProperty('create');
 | |
|     expect(agents).toHaveProperty('update');
 | |
|     expect(agents).toHaveProperty('delete');
 | |
|   });
 | |
| 
 | |
|   describe('API calls', () => {
 | |
|     const originalAxios = window.axios;
 | |
|     const axiosMock = {
 | |
|       post: vi.fn(() => Promise.resolve()),
 | |
|     };
 | |
| 
 | |
|     beforeEach(() => {
 | |
|       window.axios = axiosMock;
 | |
|     });
 | |
| 
 | |
|     afterEach(() => {
 | |
|       window.axios = originalAxios;
 | |
|     });
 | |
| 
 | |
|     it('#bulkInvite', () => {
 | |
|       agents.bulkInvite({ emails: ['hello@hi.com'] });
 | |
|       expect(axiosMock.post).toHaveBeenCalledWith(
 | |
|         '/api/v1/agents/bulk_create',
 | |
|         {
 | |
|           emails: ['hello@hi.com'],
 | |
|         }
 | |
|       );
 | |
|     });
 | |
|   });
 | |
| });
 |