Skip to content

Commit a93fdb2

Browse files
jbl428imdudu1
andcommitted
test: add missing test cases
Co-authored-by: imdudu1 <cd80@kakao.com>
1 parent ad973ba commit a93fdb2

File tree

3 files changed

+39
-0
lines changed

3 files changed

+39
-0
lines changed

lib/builders/request-form.builder.spec.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,18 @@ describe('RequestFormBuilder', () => {
1414
expect([...actual.entries()]).toEqual([['keyword', 'search']]);
1515
});
1616

17+
test('should ignore null value in args', () => {
18+
// given
19+
const builder = new RequestFormBuilder(0, 'keyword');
20+
const args = [null];
21+
22+
// when
23+
const actual = builder.build(args);
24+
25+
// then
26+
expect([...actual.entries()]).toEqual([['keyword', '']]);
27+
});
28+
1729
test('should build form data with explicit key and default', () => {
1830
// given
1931
const builder = new RequestFormBuilder(0, 'keyword', 'search');

lib/builders/request-header.builder.spec.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,21 @@ describe('RequestHeaderBuilder', () => {
1717
expect(actual).toEqual({ keyword: 'search' });
1818
});
1919

20+
test('should ignore null value in args', () => {
21+
// given
22+
const builder = new RequestHeaderBuilder({
23+
parameterIndex: 0,
24+
key: 'keyword',
25+
});
26+
const args = [null];
27+
28+
// when
29+
const actual = builder.build(args);
30+
31+
// then
32+
expect(actual).toEqual({ keyword: '' });
33+
});
34+
2035
test('should build header with explicit key and default', () => {
2136
// given
2237
const builder = new RequestHeaderBuilder({

lib/builders/request-param.builder.spec.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,18 @@ describe('RequestParamBuilder', () => {
1414
expect(actual).toBe('?keyword=search');
1515
});
1616

17+
test('should ignore null value in args', () => {
18+
// given
19+
const builder = new RequestParamBuilder(0, 'keyword');
20+
const args = [null];
21+
22+
// when
23+
const actual = builder.build(args);
24+
25+
// then
26+
expect(actual).toBe('?keyword=');
27+
});
28+
1729
test('should build query string with explicit key and default', () => {
1830
// given
1931
const builder = new RequestParamBuilder(0, 'keyword', 'default');

0 commit comments

Comments
 (0)