Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
310 additions
and
243 deletions.
There are no files selected for viewing
This file contains 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
This file was deleted.
Oops, something went wrong.
This file contains 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
26 changes: 26 additions & 0 deletions
26
packages/app/main/src/utils/exceptionToAPIException.spec.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { APIException } from '@bfemulator/app-shared'; | ||
import * as HttpStatus from 'http-status-codes'; | ||
import { exceptionToAPIException } from './exceptionToAPIException'; | ||
|
||
describe('The exceptionToAPIException', () => { | ||
it('should pass an APIException though unchanged', () => { | ||
const apiException: APIException = { | ||
error: { error: { code: '42', message: 'oh noes!' } }, | ||
statusCode: HttpStatus.BAD_REQUEST | ||
}; | ||
|
||
expect(exceptionToAPIException(apiException)).toBe(apiException); | ||
}); | ||
|
||
it('should convert an exception to an APIException', () => { | ||
const error = new Error('This is an error'); | ||
expect(exceptionToAPIException(error)).toEqual({ | ||
'error': { | ||
'error': { | ||
'code': 'ServiceError', | ||
'message': 'This is an error' | ||
} | ||
}, 'statusCode': HttpStatus.BAD_REQUEST | ||
}); | ||
}); | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { getThemes } from './getThemes'; | ||
|
||
describe('The getThemes utility', () => { | ||
it('should retrieve the available themes from the themes directory', () => { | ||
const themes = getThemes(); | ||
expect(themes).toEqual([ | ||
{ 'href': './themes/dark.css', 'name': 'Dark' }, | ||
{ 'href': './themes/high-contrast.css', 'name': 'High-contrast' }, | ||
{ 'href': './themes/light.css', 'name': 'Light' }]); | ||
}); | ||
}); |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { isLocalhostUrl } from './isLocalhostUrl'; | ||
|
||
describe('The isLocalHostUrl util', () => { | ||
it('should return true for urls that contain "localhost"', () => { | ||
expect(isLocalhostUrl('http://localhost')).toBeTruthy(); | ||
}); | ||
|
||
it('should return true for urls that contain "127.0.0.1" ', () => { | ||
expect(isLocalhostUrl('http://127.0.0.1')).toBeTruthy(); | ||
}); | ||
}); |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.