You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			22 lines
		
	
	
		
			597 B
		
	
	
	
		
			JavaScript
		
	
			
		
		
	
	
			22 lines
		
	
	
		
			597 B
		
	
	
	
		
			JavaScript
		
	
/* global Whisper */
 | 
						|
 | 
						|
describe('Threads', () => {
 | 
						|
  it('should be ordered newest to oldest', () => {
 | 
						|
    // Timestamps
 | 
						|
    const today = new Date();
 | 
						|
    const tomorrow = new Date();
 | 
						|
    tomorrow.setDate(today.getDate() + 1);
 | 
						|
 | 
						|
    // Add threads
 | 
						|
    Whisper.Threads.add({ timestamp: today });
 | 
						|
    Whisper.Threads.add({ timestamp: tomorrow });
 | 
						|
 | 
						|
    const { models } = Whisper.Threads;
 | 
						|
    const firstTimestamp = models[0].get('timestamp').getTime();
 | 
						|
    const secondTimestamp = models[1].get('timestamp').getTime();
 | 
						|
 | 
						|
    // Compare timestamps
 | 
						|
    assert(firstTimestamp > secondTimestamp);
 | 
						|
  });
 | 
						|
});
 |