mirror of
				https://github.com/strapi/strapi.git
				synced 2025-10-30 17:37:26 +00:00 
			
		
		
		
	 93752c37ca
			
		
	
	
		93752c37ca
		
			
		
	
	
	
	
		
			
			* Use new jest runner * Set loglevel to fatal * Update snapshots * Remove update option from cli Co-authored-by: Alexandre Bodin <bodin.alex@gmail.com>
		
			
				
	
	
		
			23 lines
		
	
	
		
			603 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			23 lines
		
	
	
		
			603 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| 'use strict';
 | |
| 
 | |
| const isoDateRegex = /\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z/;
 | |
| 
 | |
| jest.setTimeout(60000);
 | |
| 
 | |
| expect.extend({
 | |
|   stringOrNull(received) {
 | |
|     const pass = typeof received === 'string' || received === null;
 | |
|     return {
 | |
|       message: () => `expected ${received} ${pass ? 'not ' : ''}to be null or a string`,
 | |
|       pass,
 | |
|     };
 | |
|   },
 | |
|   toBeISODate(received) {
 | |
|     const pass = isoDateRegex.test(received) && new Date(received).toISOString() === received;
 | |
|     return {
 | |
|       pass,
 | |
|       message: () => `Expected ${received} ${pass ? 'not ' : ''}to be a valid ISO date string`,
 | |
|     };
 | |
|   },
 | |
| });
 |