This repository has been archived by the owner on Dec 11, 2024. It is now read-only.
-
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.
test(object-to-url): adicioando teste de remocão de nullish no object…
… to url params
- Loading branch information
1 parent
9cb856e
commit 0608988
Showing
3 changed files
with
28 additions
and
18 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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "@brainylab/fetch-wrapper", | ||
"version": "0.5.3", | ||
"version": "0.5.4", | ||
"keywords": [ | ||
"fetch", | ||
"wrapper", | ||
|
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 |
---|---|---|
@@ -1,17 +1,26 @@ | ||
import { test } from 'vitest'; | ||
import { describe, it, expect } from 'vitest'; | ||
|
||
import { objectToUrlParams } from './object-to-url-params'; | ||
|
||
test('object-to-url-params', () => { | ||
const obj = { a: '1', b: '2', c: '3' }; | ||
const result = objectToUrlParams(obj); | ||
describe('object-to-url-params', () => { | ||
it('should be convert object to url params', () => { | ||
const obj = { a: '1', b: '2', c: '3' }; | ||
const result = objectToUrlParams(obj); | ||
|
||
expect(result).toBe('a=1&b=2&c=3'); | ||
}); | ||
expect(result).toBe('a=1&b=2&c=3'); | ||
}); | ||
|
||
it('should be clear undefined or null object', () => { | ||
const obj = { a: undefined, b: null, c: '3' }; | ||
const result = objectToUrlParams(obj); | ||
|
||
expect(result).toBe('c=3'); | ||
}); | ||
|
||
test('array-to-url-params', () => { | ||
const obj = { d: [1, 2, 3, 4] }; | ||
const result = objectToUrlParams(obj); | ||
it('should be convert array to url params', () => { | ||
const obj = { d: [1, 2, 3, 4] }; | ||
const result = objectToUrlParams(obj); | ||
|
||
expect(result).toBe('d=1&d=2&d=3&d=4'); | ||
expect(result).toBe('d=1&d=2&d=3&d=4'); | ||
}); | ||
}); |
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