forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Fleet] Validate pagination in fleet agents API (elastic#148002)
- Loading branch information
Showing
2 changed files
with
47 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* 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 { GetAgentsRequestSchema } from './agent'; | ||
|
||
describe('GetAgentsRequestSchema', () => { | ||
it('should allow pagination with less than 10000 agents', () => { | ||
expect(() => | ||
GetAgentsRequestSchema.query.validate({ | ||
page: 500, | ||
perPage: 20, | ||
}) | ||
).not.toThrow(); | ||
}); | ||
it('should not allow pagination to go over 10000 agents', () => { | ||
expect(() => | ||
GetAgentsRequestSchema.query.validate({ | ||
page: 501, | ||
perPage: 20, | ||
}) | ||
).toThrowError(/You cannot use page and perPage page over 10000 agents/); | ||
}); | ||
}); |
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