Skip to content

Commit

Permalink
fix: tests not running
Browse files Browse the repository at this point in the history
  • Loading branch information
design1online committed Oct 12, 2023
1 parent c77498c commit 92ccd96
Show file tree
Hide file tree
Showing 11 changed files with 2,186 additions and 10,249 deletions.
6 changes: 6 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
presets: [
['@babel/preset-env', {targets: {node: 'current'}}],
'@babel/preset-typescript',
],
};
83 changes: 83 additions & 0 deletions client/index.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
/* global document, window, Event */
import Client from '.';

// mock the Detect import
jest.mock('./utils/detect');

/**
* @test {Client}
*/
describe('Client', () => {
const instance = new Client();

/**
* @test {Client#constructor}
*/
it('.constructor()', () => {
expect(Client).toBeDefined();
});

// /**
// * @test {WTF#load}
// */
// it('.load()', () => {
// expect(instance.app).toEqual(null);
// instance.load();
// expect(instance.app).toBeDefined();
// expect(instance.body).toBeDefined();
// expect(instance.chatInput).toBeDefined();
// });

// /**
// * @test {WTF#documentReady}
// */
// it('.documentReady()', () => {
// expect(instance.app).toEqual(null);
// instance.documentReady();
// expect(instance.app).toBeDefined();
// expect(instance.body).toBeDefined();
// expect(instance.chatInput).toBeDefined();
// });

// /**
// * @test {WTF#addClasses}
// */
// it('.addClasses()', () => {
// instance.documentReady();
// instance.addClasses();
// expect(instance.chatInput).toBeDefined();
// expect(instance.body[0].className).toEqual('windows opera');
// });

// /**
// * @test {WTF#addResizeListeners}
// */
// it('.addResizeListeners()', () => {
// instance.documentReady();
// const map = {};
// document.addEventListener = jest.fn((event, callback) => {
// map[event] = callback;
// });

// instance.addResizeListeners();
// expect(map.touchstart).toBeDefined();
// expect(map.touchmove).toBeDefined();
// expect(map.touchmove(new Event('test'))).toEqual(false);

// // check window orientation changes
// const updateOrientationMock = jest.spyOn(instance.app, 'updateOrientation');
// window.dispatchEvent(new Event('orientationchange'));
// expect(updateOrientationMock).toHaveBeenCalled();
// });

// /**
// * @test {WTF#initGame}
// */
// it('.initGame()', () => {
// const wtf = new WTF();
// expect(wtf.app).toEqual(null);
// wtf.documentReady();
// wtf.initGame();
// expect(wtf.app.readyCallback).toBeDefined();
// });
});
72 changes: 4 additions & 68 deletions coverage/coverage-summary.json

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions coverage/lcov-report/block-navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,14 @@ var jumpToCode = (function init() {
}

return function jump(event) {
if (
document.getElementById('fileSearch') === document.activeElement &&
document.activeElement != null
) {
// if we're currently focused on the search input, we don't want to navigate
return;
}

switch (event.which) {
case 78: // n
case 74: // j
Expand Down
Binary file modified coverage/lcov-report/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 92ccd96

Please sign in to comment.