-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into versioning-all-ml-apis
- Loading branch information
Showing
8 changed files
with
133 additions
and
124 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 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
39 changes: 39 additions & 0 deletions
39
x-pack/plugins/cases/server/client/attachments/validators.test.tsx
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,39 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { validateFindCommentsPagination } from './validators'; | ||
|
||
const ERROR_MSG = | ||
'The number of documents is too high. Paginating through more than 10,000 documents is not possible.'; | ||
|
||
describe('validators', () => { | ||
describe('validateFindCommentsPagination', () => { | ||
it('does not throw if only page is undefined', () => { | ||
expect(() => validateFindCommentsPagination({ perPage: 100 })).not.toThrowError(); | ||
}); | ||
|
||
it('does not throw if only perPage is undefined', () => { | ||
expect(() => validateFindCommentsPagination({ page: 100 })).not.toThrowError(); | ||
}); | ||
|
||
it('returns if page and perPage are undefined', () => { | ||
expect(() => validateFindCommentsPagination({})).not.toThrowError(); | ||
}); | ||
|
||
it('throws if page > 10k', () => { | ||
expect(() => validateFindCommentsPagination({ page: 10001 })).toThrow(ERROR_MSG); | ||
}); | ||
|
||
it('throws if perPage > 10k', () => { | ||
expect(() => validateFindCommentsPagination({ perPage: 10001 })).toThrowError(ERROR_MSG); | ||
}); | ||
|
||
it('throws if page * perPage > 10k', () => { | ||
expect(() => validateFindCommentsPagination({ page: 10, perPage: 1001 })).toThrow(ERROR_MSG); | ||
}); | ||
}); | ||
}); |
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
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
Oops, something went wrong.