Created
November 4, 2018 20:05
-
-
Save VivekNayyar/3a9b33e397b3312902fa21dc5529ed4f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { util } from '../helpers/utils'; | |
| describe('test cases for the exported util object', () => { | |
| test('exported object to be defined', () => { | |
| expect(util).toBeDefined(); | |
| }); | |
| test('util should be an object', () => { | |
| expect(typeof util).toBe('object'); | |
| }); | |
| }); | |
| describe('test cases for parseHeader', () => { | |
| test('should be defined', () => { | |
| expect(util.parseHeader).toBeDefined(); | |
| }); | |
| test('should return null if no requestHeader prop passed', () => { | |
| const output = util.parseHeader(); | |
| expect(output).toBeNull(); | |
| }); | |
| test('should return the value of the header', () => { | |
| const headerName = 'Retry-Time'; | |
| const expectedRetryTime = 3600; | |
| const requestObject = { | |
| headers: { | |
| [headerName]: expectedRetryTime | |
| } | |
| }; | |
| const output = util.parseHeader(requestObject, headerName); | |
| expect(output).toBe(expectedRetryTime); | |
| }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment