Skip to content
This repository was archived by the owner on May 24, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add some tests
  • Loading branch information
amaury1093 committed Sep 7, 2018
commit 206a47ef5dcc4732bce2e7da999c57de93551b49
3 changes: 2 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ module.exports = {
'^.+\\.tsx?$': 'ts-jest'
},
// testRegex: 'spec\\.(ts|tsx)$' // TODO Skip api/ tests for now, as it's still WIP
testRegex: 'packages/(abi|light.js|light.js-react)/.*spec\\.(ts|tsx)$'
testRegex:
'packages/(abi|electron|light.js|light.js-react)/.*spec\\.(ts|tsx)$'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still missing escaping the dot for light.js and light.js-react but it doesn't make a difference for all intents and purposes ^^

};
3 changes: 3 additions & 0 deletions packages/electron/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const baseConfig = require('../../jest.config');

module.exports = baseConfig;
16 changes: 16 additions & 0 deletions packages/electron/src/checkClockSync.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright 2015-2018 Parity Technologies (UK) Ltd.
// This file is part of Parity.
//
// SPDX-License-Identifier: MIT

import { checkClockSync } from './checkClockSync';

jest.mock('sntp', () => ({ time: () => Promise.resolve({ t: 1234 }) }));

it('should return the correct syncness', async done => {
expect(await checkClockSync()).toEqual({
isClockSync: true,
timeDrift: 1234
});
done();
});
10 changes: 10 additions & 0 deletions packages/electron/src/utils/logCommand.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Copyright 2015-2018 Parity Technologies (UK) Ltd.
// This file is part of Parity.
//
// SPDX-License-Identifier: MIT

import logCommand from './logCommand';

test('should correctly log a command', () => {
expect(logCommand('foo', ['-a', '23'])).toBe('Running "foo -a 23".');
});
14 changes: 14 additions & 0 deletions packages/electron/src/utils/logger.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Copyright 2015-2018 Parity Technologies (UK) Ltd.
// This file is part of Parity.
//
// SPDX-License-Identifier: MIT

import getLogger, { setLogger } from './logger';

test('should correctly set logger', () => {
const logger = () => () => {
/* Do nothing. */
};
setLogger(logger);
expect(getLogger()).toBe(logger);
});