Split decoder tests to separate files

This commit is contained in:
Pierre Ossman
2020-06-06 14:24:44 +02:00
parent 224f95f997
commit 111225fa41
7 changed files with 521 additions and 248 deletions

41
tests/test.tight.js Normal file
View File

@@ -0,0 +1,41 @@
const expect = chai.expect;
import Websock from '../core/websock.js';
import Display from '../core/display.js';
import TightDecoder from '../core/decoders/tight.js';
import FakeWebSocket from './fake.websocket.js';
function testDecodeRect(decoder, x, y, width, height, data, display, depth) {
let sock;
sock = new Websock;
sock.open("ws://example.com");
sock.on('message', () => {
decoder.decodeRect(x, y, width, height, sock, display, depth);
});
sock._websocket._receiveData(new Uint8Array(data));
display.flip();
}
describe('Tight Decoder', function () {
let decoder;
let display;
before(FakeWebSocket.replace);
after(FakeWebSocket.restore);
beforeEach(function () {
decoder = new TightDecoder();
display = new Display(document.createElement('canvas'));
display.resize(4, 4);
});
it.skip('should handle the Tight encoding', function () {
// TODO(directxman12): test this
});
});