-
Notifications
You must be signed in to change notification settings - Fork 894
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Joshua Li <[email protected]>
- Loading branch information
1 parent
896ca26
commit 742da55
Showing
2 changed files
with
31 additions
and
2 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
src/plugins/query_enhancements/server/routes/index.test.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,21 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { coerceStatusCode } from '.'; | ||
|
||
describe('coerceStatusCode', () => { | ||
it('should return 503 when input is 500', () => { | ||
expect(coerceStatusCode(500)).toBe(503); | ||
}); | ||
|
||
it('should return the input status code when it is not 500', () => { | ||
expect(coerceStatusCode(404)).toBe(404); | ||
}); | ||
|
||
it('should return 503 when input is undefined or null', () => { | ||
expect(coerceStatusCode((undefined as unknown) as number)).toBe(503); | ||
expect(coerceStatusCode((null as unknown) as number)).toBe(503); | ||
}); | ||
}); |
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