Skip to content

Commit

Permalink
add login slice test
Browse files Browse the repository at this point in the history
  • Loading branch information
stambekovbera committed Dec 1, 2023
1 parent a9ac6c3 commit 9bc859e
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/features/AuthByUsername/model/slice/loginSlice.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { ILoginSchema } from '../types/loginSchema';
import { loginActions, loginReducer } from './loginSlice';
import { DeepPartial } from '@reduxjs/toolkit';

describe( 'loginSlice test', () => {
test( 'login slice set username reducer', () => {
const state: DeepPartial<ILoginSchema> = {
username: '123',
};
expect( loginReducer( state as ILoginSchema, loginActions.setUsername( 'bera' ) ) ).toEqual( { username: 'bera' } );
} );

test( 'login slice set password reducer', () => {
const state: DeepPartial<ILoginSchema> = {
password: '123',
};
expect( loginReducer( state as ILoginSchema, loginActions.setPassword( 'password' ) ) ).toEqual( { password: 'password' } );
} );
} );

0 comments on commit 9bc859e

Please sign in to comment.