From 953de7f52177504fdba5c8f71cadcedf84bf1beb Mon Sep 17 00:00:00 2001 From: GleidsonDaniel Date: Tue, 18 Jan 2022 09:49:44 -0300 Subject: [PATCH] chore: fix any interface and change null to empty string --- app/actions/encryption.ts | 9 +++++---- app/reducers/encryption.test.ts | 10 +++++----- app/reducers/encryption.ts | 6 +++--- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/app/actions/encryption.ts b/app/actions/encryption.ts index ca3be8ce5..be3fb43fa 100644 --- a/app/actions/encryption.ts +++ b/app/actions/encryption.ts @@ -1,14 +1,15 @@ import { Action } from 'redux'; +import { IBanner } from '../reducers/encryption'; import { ENCRYPTION } from './actionsTypes'; export interface IEncryptionSet extends Action { enabled: boolean; - banner: any; + banner: IBanner; } export interface IEncryptionSetBanner extends Action { - banner: any; + banner: IBanner; } export interface IEncryptionDecodeKey extends Action { password: string; @@ -28,7 +29,7 @@ export function encryptionStop(): Action { }; } -export function encryptionSet(enabled = false, banner: any = null): IEncryptionSet { +export function encryptionSet(enabled = false, banner: IBanner = ''): IEncryptionSet { return { type: ENCRYPTION.SET, enabled, @@ -36,7 +37,7 @@ export function encryptionSet(enabled = false, banner: any = null): IEncryptionS }; } -export function encryptionSetBanner(banner: any = null): IEncryptionSetBanner { +export function encryptionSetBanner(banner: IBanner = ''): IEncryptionSetBanner { return { type: ENCRYPTION.SET_BANNER, banner diff --git a/app/reducers/encryption.test.ts b/app/reducers/encryption.test.ts index cf2a8118b..96abe2a7a 100644 --- a/app/reducers/encryption.test.ts +++ b/app/reducers/encryption.test.ts @@ -9,20 +9,20 @@ describe('test encryption reducer', () => { }); it('should return modified store after encryptionSet', () => { - mockedStore.dispatch(encryptionSet(true, true)); + mockedStore.dispatch(encryptionSet(true, 'BANNER')); const state = mockedStore.getState().encryption; - expect(state).toEqual({ banner: true, enabled: true }); + expect(state).toEqual({ banner: 'BANNER', enabled: true }); }); it('should return empty store after encryptionInit', () => { mockedStore.dispatch(encryptionInit()); const state = mockedStore.getState().encryption; - expect(state).toEqual({ banner: null, enabled: false }); + expect(state).toEqual({ banner: '', enabled: false }); }); it('should return initial state after encryptionSetBanner', () => { - mockedStore.dispatch(encryptionSetBanner(true)); + mockedStore.dispatch(encryptionSetBanner('BANNER_NEW')); const state = mockedStore.getState().encryption; - expect(state).toEqual({ banner: true, enabled: false }); + expect(state).toEqual({ banner: 'BANNER_NEW', enabled: false }); }); }); diff --git a/app/reducers/encryption.ts b/app/reducers/encryption.ts index 5854c75ad..061dc7c94 100644 --- a/app/reducers/encryption.ts +++ b/app/reducers/encryption.ts @@ -1,15 +1,15 @@ import { ENCRYPTION } from '../actions/actionsTypes'; import { TApplicationActions } from '../definitions'; +export type IBanner = string; export interface IEncryption { enabled: boolean; - // TODO - banner: any; + banner: IBanner; } export const initialState: IEncryption = { enabled: false, - banner: null + banner: '' }; export default function encryption(state = initialState, action: TApplicationActions): IEncryption {