mirror of
				https://github.com/lingble/chatwoot.git
				synced 2025-11-04 04:57:51 +00:00 
			
		
		
		
	fix: messageTimestamp test (#8644)
This commit is contained in:
		@@ -1,4 +1,5 @@
 | 
				
			|||||||
import TimeMixin from '../time';
 | 
					import TimeMixin from '../time';
 | 
				
			||||||
 | 
					import { format } from 'date-fns';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
describe('#messageStamp', () => {
 | 
					describe('#messageStamp', () => {
 | 
				
			||||||
  it('returns correct value', () => {
 | 
					  it('returns correct value', () => {
 | 
				
			||||||
@@ -11,8 +12,9 @@ describe('#messageStamp', () => {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
describe('#messageTimestamp', () => {
 | 
					describe('#messageTimestamp', () => {
 | 
				
			||||||
  it('should return the message date in the specified format if the message was sent in the current year', () => {
 | 
					  it('should return the message date in the specified format if the message was sent in the current year', () => {
 | 
				
			||||||
    expect(TimeMixin.methods.messageTimestamp(1680777464)).toEqual(
 | 
					    const currentEpochTime = Math.floor(new Date().getTime() / 1000);
 | 
				
			||||||
      'Apr 6, 2023'
 | 
					    expect(TimeMixin.methods.messageTimestamp(currentEpochTime)).toEqual(
 | 
				
			||||||
 | 
					      format(new Date(currentEpochTime * 1000), 'MMM d, yyyy')
 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
  it('should return the message date and time in a different format if the message was sent in a different year', () => {
 | 
					  it('should return the message date and time in a different format if the message was sent in a different year', () => {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user