fix: improved typing (#174)

This commit is contained in:
Thomas Klein
2019-10-10 22:20:05 +02:00
committed by Juan Picado @jotadeveloper
parent 68b7171de4
commit e0642a9d0d
16 changed files with 37 additions and 30 deletions

View File

@@ -1,27 +1,27 @@
import React from 'react';
import { mount } from 'enzyme';
import { mount, ReactWrapper } from 'enzyme';
import storage from '../utils/storage';
import { generateTokenWithTimeRange } from '../../jest/unit/components/__mocks__/token';
import App from './App';
import App, { AppStateInterface } from './App';
jest.mock('../utils/storage', () => {
class LocalStorageMock {
private store: object;
private store: Record<string, string>;
public constructor() {
this.store = {};
}
public clear(): void {
this.store = {};
}
public getItem(key): unknown {
public getItem(key: string): unknown {
return this.store[key] || null;
}
public setItem(key, value): void {
public setItem(key: string, value: string): void {
this.store[key] = value.toString();
}
public removeItem(key): void {
public removeItem(key: string): void {
delete this.store[key];
}
}
@@ -33,7 +33,7 @@ jest.mock('../utils/api', () => ({
}));
describe('App', () => {
let wrapper;
let wrapper: ReactWrapper<{}, AppStateInterface, App>;
beforeEach(() => {
wrapper = mount(<App />);