mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-04-24 18:38:15 +01:00
Fixes #61 - Order by timestamps with tests
This commit is contained in:
22
test/views/threads_test.js
Normal file
22
test/views/threads_test.js
Normal file
@@ -0,0 +1,22 @@
|
||||
describe('Threads', function() {
|
||||
|
||||
it('should be ordered newest to oldest', function() {
|
||||
// Timestamps
|
||||
var today = new Date();
|
||||
var tomorrow = new Date();
|
||||
tomorrow.setDate(today.getDate()+1);
|
||||
|
||||
// Add threads
|
||||
Whisper.Threads.add({ timestamp: today });
|
||||
Whisper.Threads.add({ timestamp: tomorrow });
|
||||
|
||||
var models = Whisper.Threads.models;
|
||||
var firstTimestamp = models[0].get('timestamp').getTime();
|
||||
var secondTimestamp = models[1].get('timestamp').getTime();
|
||||
|
||||
// Compare timestamps
|
||||
assert(firstTimestamp > secondTimestamp);
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user