eslintify all test files

This commit is contained in:
Scott Nonnenberg
2018-11-02 11:02:53 -07:00
parent 884bc9333d
commit dbf0be2db5
44 changed files with 1469 additions and 1484 deletions

View File

@@ -1,11 +1,13 @@
describe('ConversationSearchView', function() {
it('should match partial numbers', function() {
var $el = $('<div><div class="new-contact contact hide"></div></div>');
var view = new Whisper.ConversationSearchView({
/* global $, Whisper */
describe('ConversationSearchView', () => {
it('should match partial numbers', () => {
const $el = $('<div><div class="new-contact contact hide"></div></div>');
const view = new Whisper.ConversationSearchView({
el: $el,
input: $('<input>'),
}).render();
var maybe_numbers = [
const maybeNumbers = [
'+1 415',
'+1415',
'+1415',
@@ -19,11 +21,11 @@ describe('ConversationSearchView', function() {
'1 415-123-4567',
'415-123-4567',
];
maybe_numbers.forEach(function(n) {
maybeNumbers.forEach(n => {
assert.ok(view.maybeNumber(n), n);
});
});
describe('Searching for left groups', function() {
describe('Searching for left groups', () => {
let convo;
before(() => {
@@ -39,32 +41,32 @@ describe('ConversationSearchView', function() {
Conversation: Whisper.Conversation,
});
});
describe('with no messages', function() {
var input;
var view;
describe('with no messages', () => {
let input;
let view;
before(function(done) {
before(done => {
input = $('<input>');
view = new Whisper.ConversationSearchView({ input: input }).render();
view = new Whisper.ConversationSearchView({ input }).render();
view.$input.val('left');
view.filterContacts();
view.typeahead_view.collection.on('reset', function() {
view.typeahead_view.collection.on('reset', () => {
done();
});
});
it('should not surface left groups with no messages', function() {
it('should not surface left groups with no messages', () => {
assert.isUndefined(
view.typeahead_view.collection.get(convo.id),
'got left group'
);
});
});
describe('with messages', function() {
var input;
var view;
before(async function() {
describe('with messages', () => {
let input;
let view;
before(async () => {
input = $('<input>');
view = new Whisper.ConversationSearchView({ input: input }).render();
view = new Whisper.ConversationSearchView({ input }).render();
convo.set({ id: '2-search-view', left: false });
await window.Signal.Data.saveConversation(convo.attributes, {
@@ -78,7 +80,7 @@ describe('ConversationSearchView', function() {
view.typeahead_view.collection.on('reset', resolve);
});
});
it('should surface left groups with messages', function() {
it('should surface left groups with messages', () => {
assert.isDefined(
view.typeahead_view.collection.get(convo.id),
'got left group'