mirror of
https://github.com/seigler/js-bitcoin-wallet
synced 2025-07-26 08:26:09 +00:00
initial commit
This commit is contained in:
commit
9a0b1c1254
28 changed files with 42055 additions and 0 deletions
21
tests/__mocks__/browserMocks.js
Normal file
21
tests/__mocks__/browserMocks.js
Normal file
|
@ -0,0 +1,21 @@
|
|||
// Mock Browser API's which are not supported by JSDOM, e.g. ServiceWorker, LocalStorage
|
||||
/**
|
||||
* An example how to mock localStorage is given below 👇
|
||||
*/
|
||||
|
||||
/*
|
||||
// Mocks localStorage
|
||||
const localStorageMock = (function() {
|
||||
let store = {};
|
||||
|
||||
return {
|
||||
getItem: (key) => store[key] || null,
|
||||
setItem: (key, value) => store[key] = value.toString(),
|
||||
clear: () => store = {}
|
||||
};
|
||||
|
||||
})();
|
||||
|
||||
Object.defineProperty(window, 'localStorage', {
|
||||
value: localStorageMock
|
||||
}); */
|
3
tests/__mocks__/fileMocks.js
Normal file
3
tests/__mocks__/fileMocks.js
Normal file
|
@ -0,0 +1,3 @@
|
|||
// This fixed an error related to the CSS and loading gif breaking my Jest test
|
||||
// See https://facebook.github.io/jest/docs/en/webpack.html#handling-static-assets
|
||||
module.exports = 'test-file-stub';
|
6
tests/__mocks__/setupTests.js
Normal file
6
tests/__mocks__/setupTests.js
Normal file
|
@ -0,0 +1,6 @@
|
|||
import { configure } from 'enzyme';
|
||||
import Adapter from 'enzyme-adapter-preact-pure';
|
||||
|
||||
configure({
|
||||
adapter: new Adapter()
|
||||
});
|
12
tests/header.test.js
Normal file
12
tests/header.test.js
Normal file
|
@ -0,0 +1,12 @@
|
|||
import { h } from 'preact';
|
||||
import Header from '../src/components/header';
|
||||
// See: https://github.com/preactjs/enzyme-adapter-preact-pure
|
||||
import { shallow } from 'enzyme';
|
||||
|
||||
describe('Initial Test of the Header', () => {
|
||||
test('Header renders 3 nav items', () => {
|
||||
const context = shallow(<Header />);
|
||||
expect(context.find('h1').text()).toBe('Preact App');
|
||||
expect(context.find('Link').length).toBe(3);
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue