mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	Add reducer test
This commit is contained in:
		
							parent
							
								
									61f7db603d
								
							
						
					
					
						commit
						5a15396ce4
					
				
							
								
								
									
										40
									
								
								frontend/src/__mocks__/react-mdl.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										40
									
								
								frontend/src/__mocks__/react-mdl.js
									
									
									
									
										vendored
									
									
								
							| @ -1,22 +1,22 @@ | |||||||
| module.exports = { | module.exports = { | ||||||
|   Card: "react-mdl-Card", |     Card: 'react-mdl-Card', | ||||||
|   CardTitle: "react-mdl-CardTitle", |     CardTitle: 'react-mdl-CardTitle', | ||||||
|   CardText: "react-mdl-CardText", |     CardText: 'react-mdl-CardText', | ||||||
|   CardMenu: "react-mdl-CardMenu", |     CardMenu: 'react-mdl-CardMenu', | ||||||
|   DataTable: "react-mdl-DataTable", |     DataTable: 'react-mdl-DataTable', | ||||||
|   Cell: "react-mdl-Cell", |     Cell: 'react-mdl-Cell', | ||||||
|   Grid: "react-mdl-Grid", |     Grid: 'react-mdl-Grid', | ||||||
|   Icon: "react-mdl-Icon", |     Icon: 'react-mdl-Icon', | ||||||
|   IconButton: "react-mdl-IconButton", |     IconButton: 'react-mdl-IconButton', | ||||||
|   List: "react-mdl-List", |     List: 'react-mdl-List', | ||||||
|   ListItem: "react-mdl-ListItem", |     ListItem: 'react-mdl-ListItem', | ||||||
|   ListItemContent: "react-mdl-ListItemContent", |     ListItemContent: 'react-mdl-ListItemContent', | ||||||
|   ProgressBar: "react-mdl-ProgressBar", |     ProgressBar: 'react-mdl-ProgressBar', | ||||||
|   Switch: "react-mdl-Switch", |     Switch: 'react-mdl-Switch', | ||||||
|   Tab: "react-mdl-Tab", |     Tab: 'react-mdl-Tab', | ||||||
|   Tabs: "react-mdl-Tabs", |     Tabs: 'react-mdl-Tabs', | ||||||
|   TableHeader: "react-mdl-TableHeader", |     TableHeader: 'react-mdl-TableHeader', | ||||||
|   Textfield: "react-mdl-Textfield", |     Textfield: 'react-mdl-Textfield', | ||||||
|   FooterSection: "react-mdl-FooterSection", |     FooterSection: 'react-mdl-FooterSection', | ||||||
|   FooterLinkList: "react-mdl-FooterLinkList" |     FooterLinkList: 'react-mdl-FooterLinkList', | ||||||
| }; | }; | ||||||
|  | |||||||
							
								
								
									
										5
									
								
								frontend/src/store/api/__tests__/.eslintrc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								frontend/src/store/api/__tests__/.eslintrc
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,5 @@ | |||||||
|  | { | ||||||
|  |     "env": { | ||||||
|  |         "jest": true | ||||||
|  |     } | ||||||
|  | } | ||||||
							
								
								
									
										18
									
								
								frontend/src/store/api/__tests__/api-store-tests.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								frontend/src/store/api/__tests__/api-store-tests.js
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,18 @@ | |||||||
|  | import apiReducer from '../index'; | ||||||
|  | import { RECIEVE_API_DETAILS } from '../actions'; | ||||||
|  | 
 | ||||||
|  | test('should have inital state', () => { | ||||||
|  |     const store = apiReducer(undefined, {}); | ||||||
|  |     expect(store.toJS()).toEqual({}); | ||||||
|  | }); | ||||||
|  | 
 | ||||||
|  | test('should have new state', () => { | ||||||
|  |     const store = apiReducer(undefined, { type: RECIEVE_API_DETAILS, value: { version: '1.1.1' } }); | ||||||
|  |     expect(store.toJS()).toEqual({ version: '1.1.1' }); | ||||||
|  | }); | ||||||
|  | 
 | ||||||
|  | test('should have updated state', () => { | ||||||
|  |     const inital = apiReducer(undefined, { type: RECIEVE_API_DETAILS, value: { version: '1.1.1' } }); | ||||||
|  |     const store = apiReducer(inital, { type: RECIEVE_API_DETAILS, value: { version: '1.2.1' } }); | ||||||
|  |     expect(store.toJS()).toEqual({ version: '1.2.1' }); | ||||||
|  | }); | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user