Now we've got everything prettified!
This commit is contained in:
parent
754d65ae2e
commit
a0ed993b42
30 changed files with 3562 additions and 2873 deletions
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
describe("AccountManager", function() {
|
||||
describe('AccountManager', function() {
|
||||
let accountManager;
|
||||
let originalServer;
|
||||
|
||||
|
@ -35,19 +35,23 @@ describe("AccountManager", function() {
|
|||
|
||||
it('keeps three confirmed keys even if over a week old', function() {
|
||||
const now = Date.now();
|
||||
signedPreKeys = [{
|
||||
keyId: 1,
|
||||
created_at: now - DAY * 21,
|
||||
confirmed: true,
|
||||
}, {
|
||||
keyId: 2,
|
||||
created_at: now - DAY * 14,
|
||||
confirmed: true,
|
||||
}, {
|
||||
keyId: 3,
|
||||
created_at: now - DAY * 18,
|
||||
confirmed: true,
|
||||
}];
|
||||
signedPreKeys = [
|
||||
{
|
||||
keyId: 1,
|
||||
created_at: now - DAY * 21,
|
||||
confirmed: true,
|
||||
},
|
||||
{
|
||||
keyId: 2,
|
||||
created_at: now - DAY * 14,
|
||||
confirmed: true,
|
||||
},
|
||||
{
|
||||
keyId: 3,
|
||||
created_at: now - DAY * 18,
|
||||
confirmed: true,
|
||||
},
|
||||
];
|
||||
|
||||
// should be no calls to store.removeSignedPreKey, would cause crash
|
||||
return accountManager.cleanSignedPreKeys();
|
||||
|
@ -55,27 +59,33 @@ describe("AccountManager", function() {
|
|||
|
||||
it('eliminates confirmed keys over a week old, if more than three', function() {
|
||||
const now = Date.now();
|
||||
signedPreKeys = [{
|
||||
keyId: 1,
|
||||
created_at: now - DAY * 21,
|
||||
confirmed: true,
|
||||
}, {
|
||||
keyId: 2,
|
||||
created_at: now - DAY * 14,
|
||||
confirmed: true,
|
||||
}, {
|
||||
keyId: 3,
|
||||
created_at: now - DAY * 4,
|
||||
confirmed: true,
|
||||
}, {
|
||||
keyId: 4,
|
||||
created_at: now - DAY * 18,
|
||||
confirmed: true,
|
||||
}, {
|
||||
keyId: 5,
|
||||
created_at: now - DAY,
|
||||
confirmed: true,
|
||||
}];
|
||||
signedPreKeys = [
|
||||
{
|
||||
keyId: 1,
|
||||
created_at: now - DAY * 21,
|
||||
confirmed: true,
|
||||
},
|
||||
{
|
||||
keyId: 2,
|
||||
created_at: now - DAY * 14,
|
||||
confirmed: true,
|
||||
},
|
||||
{
|
||||
keyId: 3,
|
||||
created_at: now - DAY * 4,
|
||||
confirmed: true,
|
||||
},
|
||||
{
|
||||
keyId: 4,
|
||||
created_at: now - DAY * 18,
|
||||
confirmed: true,
|
||||
},
|
||||
{
|
||||
keyId: 5,
|
||||
created_at: now - DAY,
|
||||
confirmed: true,
|
||||
},
|
||||
];
|
||||
|
||||
let count = 0;
|
||||
window.textsecure.storage.protocol.removeSignedPreKey = function(keyId) {
|
||||
|
@ -93,19 +103,24 @@ describe("AccountManager", function() {
|
|||
|
||||
it('keeps at least three unconfirmed keys if no confirmed', function() {
|
||||
const now = Date.now();
|
||||
signedPreKeys = [{
|
||||
keyId: 1,
|
||||
created_at: now - DAY * 14,
|
||||
}, {
|
||||
keyId: 2,
|
||||
created_at: now - DAY * 21,
|
||||
}, {
|
||||
keyId: 3,
|
||||
created_at: now - DAY * 18,
|
||||
}, {
|
||||
keyId: 4,
|
||||
created_at: now - DAY
|
||||
}];
|
||||
signedPreKeys = [
|
||||
{
|
||||
keyId: 1,
|
||||
created_at: now - DAY * 14,
|
||||
},
|
||||
{
|
||||
keyId: 2,
|
||||
created_at: now - DAY * 21,
|
||||
},
|
||||
{
|
||||
keyId: 3,
|
||||
created_at: now - DAY * 18,
|
||||
},
|
||||
{
|
||||
keyId: 4,
|
||||
created_at: now - DAY,
|
||||
},
|
||||
];
|
||||
|
||||
let count = 0;
|
||||
window.textsecure.storage.protocol.removeSignedPreKey = function(keyId) {
|
||||
|
@ -123,21 +138,26 @@ describe("AccountManager", function() {
|
|||
|
||||
it('if some confirmed keys, keeps unconfirmed to addd up to three total', function() {
|
||||
const now = Date.now();
|
||||
signedPreKeys = [{
|
||||
keyId: 1,
|
||||
created_at: now - DAY * 21,
|
||||
confirmed: true,
|
||||
}, {
|
||||
keyId: 2,
|
||||
created_at: now - DAY * 14,
|
||||
confirmed: true,
|
||||
}, {
|
||||
keyId: 3,
|
||||
created_at: now - DAY * 12,
|
||||
}, {
|
||||
keyId: 4,
|
||||
created_at: now - DAY * 8,
|
||||
}];
|
||||
signedPreKeys = [
|
||||
{
|
||||
keyId: 1,
|
||||
created_at: now - DAY * 21,
|
||||
confirmed: true,
|
||||
},
|
||||
{
|
||||
keyId: 2,
|
||||
created_at: now - DAY * 14,
|
||||
confirmed: true,
|
||||
},
|
||||
{
|
||||
keyId: 3,
|
||||
created_at: now - DAY * 12,
|
||||
},
|
||||
{
|
||||
keyId: 4,
|
||||
created_at: now - DAY * 8,
|
||||
},
|
||||
];
|
||||
|
||||
let count = 0;
|
||||
window.textsecure.storage.protocol.removeSignedPreKey = function(keyId) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue