Eslintify all of libtextsecure

This commit is contained in:
Scott Nonnenberg 2018-07-21 14:51:20 -07:00
parent 4b3f9e969a
commit 0774ba2903
36 changed files with 1960 additions and 2128 deletions

View file

@ -1,10 +1,8 @@
'use strict';
describe('Helpers', function() {
describe('ArrayBuffer->String conversion', function() {
it('works', function() {
var b = new ArrayBuffer(3);
var a = new Uint8Array(b);
describe('Helpers', () => {
describe('ArrayBuffer->String conversion', () => {
it('works', () => {
const b = new ArrayBuffer(3);
const a = new Uint8Array(b);
a[0] = 0;
a[1] = 255;
a[2] = 128;
@ -12,18 +10,18 @@ describe('Helpers', function() {
});
});
describe('stringToArrayBuffer', function() {
it('returns ArrayBuffer when passed string', function() {
var StaticArrayBufferProto = new ArrayBuffer().__proto__;
var anArrayBuffer = new ArrayBuffer(1);
var typedArray = new Uint8Array(anArrayBuffer);
describe('stringToArrayBuffer', () => {
it('returns ArrayBuffer when passed string', () => {
const StaticArrayBufferProto = new ArrayBuffer().__proto__;
const anArrayBuffer = new ArrayBuffer(1);
const typedArray = new Uint8Array(anArrayBuffer);
typedArray[0] = 'a'.charCodeAt(0);
assertEqualArrayBuffers(stringToArrayBuffer('a'), anArrayBuffer);
});
it('throws an error when passed a non string', function() {
var notStringable = [{}, undefined, null, new ArrayBuffer()];
notStringable.forEach(function(notString) {
assert.throw(function() {
it('throws an error when passed a non string', () => {
const notStringable = [{}, undefined, null, new ArrayBuffer()];
notStringable.forEach(notString => {
assert.throw(() => {
stringToArrayBuffer(notString);
}, Error);
});