-
Notifications
You must be signed in to change notification settings - Fork 297
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Development: Fix client test coverage (#9703)
- Loading branch information
1 parent
3bff129
commit 25146ba
Showing
2 changed files
with
46 additions
and
0 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,35 @@ | ||
import { createNestedRequestOption } from 'app/shared/util/request.util'; | ||
import { HttpParams } from '@angular/common/http'; | ||
|
||
describe('createNestedRequestOption', () => { | ||
it('should create HttpParams with nested keys', () => { | ||
const req = { key1: 'value1', key2: 'value2' }; | ||
const parentKey = 'parent'; | ||
const params: HttpParams = createNestedRequestOption(req, parentKey); | ||
|
||
expect(params.get('parent.key1')).toBe('value1'); | ||
expect(params.get('parent.key2')).toBe('value2'); | ||
}); | ||
|
||
it('should create HttpParams without parent key', () => { | ||
const req = { key1: 'value1', key2: 'value2' }; | ||
const params: HttpParams = createNestedRequestOption(req); | ||
|
||
expect(params.get('key1')).toBe('value1'); | ||
expect(params.get('key2')).toBe('value2'); | ||
}); | ||
|
||
it('should append sort parameters', () => { | ||
const req = { sort: ['value1', 'value2'] }; | ||
const parentKey = 'parent'; | ||
const params: HttpParams = createNestedRequestOption(req, parentKey); | ||
|
||
expect(params.getAll('parent.sort')).toEqual(['value1', 'value2']); | ||
}); | ||
|
||
it('should handle empty request object', () => { | ||
const params: HttpParams = createNestedRequestOption(); | ||
|
||
expect(params.keys()).toHaveLength(0); | ||
}); | ||
}); |
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