Move to npm for several dependencies
mustache jQuery underscore backbone mocha chai intl-tel-input
This commit is contained in:
parent
a593a148e8
commit
cfe0bd0e79
32 changed files with 146 additions and 35694 deletions
|
@ -68,19 +68,16 @@ before(function(done) {
|
|||
};
|
||||
});
|
||||
|
||||
async function clearDatabase(done) {
|
||||
async function clearDatabase() {
|
||||
await Signal.Migrations.Migrations0DatabaseWithAttachmentData.run({
|
||||
Backbone,
|
||||
databaseName: Whisper.Database.id,
|
||||
});
|
||||
|
||||
const convos = new Whisper.ConversationCollection();
|
||||
await convos.fetch();
|
||||
await convos.destroyAll();
|
||||
await wrapDeferred(convos.fetch());
|
||||
await wrapDeferred(convos.destroyAll());
|
||||
const messages = new Whisper.MessageCollection();
|
||||
await messages.fetch();
|
||||
await messages.destroyAll();
|
||||
if (done) {
|
||||
done();
|
||||
}
|
||||
await wrapDeferred(messages.fetch());
|
||||
await wrapDeferred(messages.destroyAll());
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<head>
|
||||
<meta charset='utf-8'>
|
||||
<title>TextSecure test runner</title>
|
||||
<link rel="stylesheet" href="../components/mocha/mocha.css" />
|
||||
<link rel="stylesheet" href="../node_modules/mocha/mocha.css" />
|
||||
<link rel="stylesheet" href="../stylesheets/manifest.css" />
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
@ -41,7 +41,7 @@ describe('KeyChangeListener', function() {
|
|||
done();
|
||||
});
|
||||
});
|
||||
return store.saveIdentity(address.toString(), newKey);
|
||||
store.saveIdentity(address.toString(), newKey);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -68,7 +68,7 @@ describe('KeyChangeListener', function() {
|
|||
done();
|
||||
});
|
||||
});
|
||||
return store.saveIdentity(address.toString(), newKey);
|
||||
store.saveIdentity(address.toString(), newKey);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -268,15 +268,11 @@
|
|||
it('matches by name', function(done) {
|
||||
testSearch(['John', 'Doe', 'john', 'doe', 'John Doe', 'john doe'], done);
|
||||
});
|
||||
it('does not match +', function(done) {
|
||||
it('does not match +', function() {
|
||||
var collection = new Whisper.ConversationCollection();
|
||||
return collection
|
||||
.search('+')
|
||||
.then(function() {
|
||||
assert.isUndefined(collection.get(convo.id), 'got result for "+"');
|
||||
done();
|
||||
})
|
||||
.catch(done);
|
||||
return collection.search('+').then(function() {
|
||||
assert.isUndefined(collection.get(convo.id), 'got result for "+"');
|
||||
});
|
||||
});
|
||||
});
|
||||
})();
|
||||
|
|
|
@ -81,16 +81,15 @@ describe('SignalProtocolStore', function() {
|
|||
});
|
||||
|
||||
describe('When there is no existing key (first use)', function() {
|
||||
before(function(done) {
|
||||
store.removeIdentityKey(identifier).then(function() {
|
||||
store
|
||||
.saveIdentity(address.toString(), testKey.pubKey)
|
||||
.then(function() {
|
||||
record.fetch().then(function() {
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
before(function() {
|
||||
return store
|
||||
.removeIdentityKey(identifier)
|
||||
.then(function() {
|
||||
return store.saveIdentity(address.toString(), testKey.pubKey);
|
||||
})
|
||||
.then(function() {
|
||||
return wrapDeferred(record.fetch());
|
||||
});
|
||||
});
|
||||
it('marks the key firstUse', function() {
|
||||
assert(record.get('firstUse'));
|
||||
|
@ -1197,13 +1196,10 @@ describe('SignalProtocolStore', function() {
|
|||
})
|
||||
.then(done, done);
|
||||
});
|
||||
it('returns empty array for a number with no device ids', function(done) {
|
||||
return store
|
||||
.getDeviceIds('foo')
|
||||
.then(function(deviceIds) {
|
||||
assert.sameMembers(deviceIds, []);
|
||||
})
|
||||
.then(done, done);
|
||||
it('returns empty array for a number with no device ids', function() {
|
||||
return store.getDeviceIds('foo').then(function(deviceIds) {
|
||||
assert.sameMembers(deviceIds, []);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -31,8 +31,8 @@ describe('ConversationSearchView', function() {
|
|||
type: 'group',
|
||||
left: true,
|
||||
});
|
||||
before(function(done) {
|
||||
convo.save().then(done);
|
||||
before(() => {
|
||||
return wrapDeferred(convo.save());
|
||||
});
|
||||
describe('with no messages', function() {
|
||||
var input = $('<input>');
|
||||
|
@ -82,13 +82,13 @@ describe('ConversationSearchView', function() {
|
|||
type: 'group',
|
||||
left: true,
|
||||
});
|
||||
before(function(done) {
|
||||
convo.save().then(done);
|
||||
before(() => {
|
||||
return wrapDeferred(convo.save());
|
||||
});
|
||||
describe('with no messages', function() {
|
||||
before(function(done) {
|
||||
view.resetTypeahead();
|
||||
view.typeahead_view.collection.on('reset', function() {
|
||||
view.typeahead_view.collection.once('reset', function() {
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
@ -100,12 +100,12 @@ describe('ConversationSearchView', function() {
|
|||
});
|
||||
});
|
||||
describe('with messages', function() {
|
||||
before(function(done) {
|
||||
convo.save({ lastMessage: 'asdf' }).then(function() {
|
||||
view.typeahead_view.collection.on('reset', function() {
|
||||
before(done => {
|
||||
wrapDeferred(convo.save({ lastMessage: 'asdf' })).then(function() {
|
||||
view.resetTypeahead();
|
||||
view.typeahead_view.collection.once('reset', function() {
|
||||
done();
|
||||
});
|
||||
view.resetTypeahead();
|
||||
});
|
||||
});
|
||||
it('should surface left groups with messages', function() {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
describe('MessageView', function() {
|
||||
var convo, message;
|
||||
|
||||
before(async done => {
|
||||
before(async () => {
|
||||
await clearDatabase();
|
||||
convo = new Whisper.Conversation({ id: 'foo' });
|
||||
message = convo.messageCollection.add({
|
||||
|
@ -13,7 +13,6 @@ describe('MessageView', function() {
|
|||
});
|
||||
|
||||
await storage.put('number_id', '+18088888888.1');
|
||||
done();
|
||||
});
|
||||
|
||||
it('should display the message text', function() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue