Convert ui and util tests to ES6.

Issue #1157

Change-Id: Ib4edb2eb06a302385ca7ca084367803356b8aae6
This commit is contained in:
Jacob Trimble
2019-05-21 14:52:10 -07:00
parent 53474af3c3
commit 12d71f9ebd
8 changed files with 331 additions and 404 deletions
+7 -9
View File
@@ -89,15 +89,13 @@ describe('StringUtils', () => {
});
it('fails if unable to guess', () => {
try {
const arr = [0x01, 0x02, 0x03, 0x04];
const buffer = new Uint8Array(arr).buffer;
StringUtils.fromBytesAutoDetect(buffer);
fail('Should not be able to guess');
} catch (e) {
expect(e.category).toBe(shaka.util.Error.Category.TEXT);
expect(e.code).toBe(shaka.util.Error.Code.UNABLE_TO_DETECT_ENCODING);
}
const expected = shaka.test.Util.jasmineError(new shaka.util.Error(
shaka.util.Error.Severity.CRITICAL,
shaka.util.Error.Category.TEXT,
shaka.util.Error.Code.UNABLE_TO_DETECT_ENCODING));
const arr = [0x01, 0x02, 0x03, 0x04];
const buffer = new Uint8Array(arr).buffer;
expect(() => StringUtils.fromBytesAutoDetect(buffer)).toThrow(expected);
});
});