mirror of
				https://github.com/elyby/accounts-frontend.git
				synced 2025-05-31 14:11:58 +05:30 
			
		
		
		
	
		
			
				
	
	
		
			48 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			48 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
import expect from 'app/test/unexpected';
 | 
						|
import auth from './reducer';
 | 
						|
import {
 | 
						|
  setLogin,
 | 
						|
  SET_CREDENTIALS,
 | 
						|
  setAccountSwitcher,
 | 
						|
  SET_SWITCHER,
 | 
						|
} from './actions';
 | 
						|
 | 
						|
describe('components/auth/reducer', () => {
 | 
						|
  describe(SET_CREDENTIALS, () => {
 | 
						|
    it('should set login', () => {
 | 
						|
      const expectedLogin = 'foo';
 | 
						|
 | 
						|
      expect(
 | 
						|
        auth(undefined, setLogin(expectedLogin)).credentials,
 | 
						|
        'to satisfy',
 | 
						|
        {
 | 
						|
          login: expectedLogin,
 | 
						|
        },
 | 
						|
      );
 | 
						|
    });
 | 
						|
  });
 | 
						|
 | 
						|
  describe(SET_SWITCHER, () => {
 | 
						|
    it('should be enabled by default', () =>
 | 
						|
      expect(auth(undefined, {} as any), 'to satisfy', {
 | 
						|
        isSwitcherEnabled: true,
 | 
						|
      }));
 | 
						|
 | 
						|
    it('should enable switcher', () => {
 | 
						|
      const expectedValue = true;
 | 
						|
 | 
						|
      expect(auth(undefined, setAccountSwitcher(expectedValue)), 'to satisfy', {
 | 
						|
        isSwitcherEnabled: expectedValue,
 | 
						|
      });
 | 
						|
    });
 | 
						|
 | 
						|
    it('should disable switcher', () => {
 | 
						|
      const expectedValue = false;
 | 
						|
 | 
						|
      expect(auth(undefined, setAccountSwitcher(expectedValue)), 'to satisfy', {
 | 
						|
        isSwitcherEnabled: expectedValue,
 | 
						|
      });
 | 
						|
    });
 | 
						|
  });
 | 
						|
});
 |