-
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.
refactor(url/slug): delete unnecessary args
- Loading branch information
1 parent
bde0ea1
commit 433b68d
Showing
3 changed files
with
11 additions
and
34 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,24 +1,10 @@ | ||
import { expect, test } from "vitest"; | ||
import { sluggize } from "../../../src/utils/url"; | ||
|
||
test('should sluggize from string array - without prefix and fallback option', () => { | ||
expect(sluggize(['foo', 'bar'])).toEqual('/foo/bar'); | ||
test('should sluggize from array', () => { | ||
expect(sluggize(['foo', 'bar'])).toEqual('foo/bar'); | ||
}); | ||
|
||
test('should sluggize from number array - without prefix and fallback option', () => { | ||
expect(sluggize([1, 2])).toEqual('/1/2'); | ||
test('should sluggize from array - contains double slashes', () => { | ||
expect(sluggize(['foo//bar', '/hoge/', '/piyo'])).toEqual('foo/bar/hoge/piyo'); | ||
}); | ||
|
||
test('should sluggize from array - without fallback option', () => { | ||
expect(sluggize(['foo', 'bar'], '_prefix')).toEqual('/_prefix/foo/bar'); | ||
}); | ||
|
||
/* TODO: fix | ||
test('should sluggize returns fallback (undefined) if slug can not convert to array', () => { | ||
expect(sluggize({'hoge': 'piyo'}, '_prefix')).toEqual(undefined); | ||
}); | ||
test('should sluggize returns fallback string if slug can not convert to array', () => { | ||
expect(sluggize({'hoge': 'piyo'}, '_prefix', 'fallback_str')).toEqual('fallback_str'); | ||
}); | ||
*/ |
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