-
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.
- Loading branch information
1 parent
aca96a6
commit 3223078
Showing
21 changed files
with
363 additions
and
22 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
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
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": "@powership/boilerplate", | ||
"version": "3.1.7", | ||
"version": "3.1.8", | ||
"author": "antoniopresto <[email protected]>", | ||
"sideEffects": false, | ||
"#type": "module", | ||
|
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "logstorm", | ||
"version": "3.1.7", | ||
"version": "3.1.8", | ||
"typings": "out", | ||
"author": "antoniopresto <[email protected]>", | ||
"#type": "module", | ||
|
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
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": "powership", | ||
"version": "3.1.7", | ||
"version": "3.1.8", | ||
"author": "antoniopresto <[email protected]>", | ||
"#type": "module", | ||
"main": "./out/index.cjs", | ||
|
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": "runmate", | ||
"version": "3.1.7", | ||
"version": "3.1.8", | ||
"typings": "out", | ||
"author": "antoniopresto <[email protected]>", | ||
"license": "MIT", | ||
|
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
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
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": "@powership/utils", | ||
"version": "3.1.7", | ||
"version": "3.1.8", | ||
"typings": "out", | ||
"author": "antoniopresto <[email protected]>", | ||
"license": "MIT", | ||
|
@@ -62,7 +62,9 @@ | |
"prettier": "2.8.8", | ||
"slugify": "1.6.5", | ||
"ts-toolbelt": "9.6.0", | ||
"ulid": "2.3.0" | ||
"ulid": "2.3.0", | ||
"qs": "6.11.2", | ||
"url-pattern": "1.0.3" | ||
}, | ||
"devDependencies": { | ||
"@powership/boilerplate": "workspace:*", | ||
|
@@ -72,6 +74,7 @@ | |
"@babel/preset-typescript": "7.18.6", | ||
"@powership/babel-plugins": "workspace:*", | ||
"@types/big.js": "6.1.6", | ||
"@types/qs": "6.9.10", | ||
"@types/deep-diff": "^1.0.2", | ||
"@types/ejson": "2.2.0", | ||
"@types/fs-extra": "9.0.13", | ||
|
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,86 @@ | ||
import { RouteUtils } from '../routeUtils'; // Adjust the import path as necessary | ||
|
||
describe('RouteUtils', () => { | ||
describe('normalizePath', () => { | ||
it('should remove starting and trailing slashes', () => { | ||
expect(RouteUtils.normalizePath('/a/b/c/')).toBe('a/b/c'); | ||
}); | ||
|
||
it('should remove double slashes', () => { | ||
expect(RouteUtils.normalizePath('a//b//c')).toBe('a/b/c'); | ||
}); | ||
}); | ||
|
||
describe('joinPaths', () => { | ||
it('should join multiple path segments', () => { | ||
expect( | ||
RouteUtils.joinPaths('/a/', 'b', null, undefined, '', '/c', 'd/') | ||
).toBe('a/b/c/d'); | ||
}); | ||
}); | ||
|
||
describe('parseQueryString', () => { | ||
it('should parse query string into an object', () => { | ||
expect(RouteUtils.parseQueryString('?key1=value1&key2=value2')).toEqual({ | ||
key1: 'value1', | ||
key2: 'value2', | ||
}); | ||
}); | ||
}); | ||
|
||
describe('stringifyQueryString', () => { | ||
it('should stringify an object into a query string', () => { | ||
expect( | ||
RouteUtils.stringifyQueryString({ key1: 'value1', key2: 'value2' }) | ||
).toBe('key1=value1&key2=value2'); | ||
}); | ||
}); | ||
|
||
describe('resortQueryString', () => { | ||
it('should resort query string', () => { | ||
expect(RouteUtils.resortQueryString('?b=2&a=1')).toBe('a=1&b=2'); | ||
}); | ||
}); | ||
|
||
describe('parseURL', () => { | ||
it('should parse URL into its components', () => { | ||
const parsed = RouteUtils.parseURL('/test?query=string#hash'); | ||
|
||
expect(parsed).toEqual({ | ||
pathname: '/test', | ||
search: '?query=string', | ||
hash: '#hash', | ||
route: '/test?query=string#hash', | ||
id: 'test^query=string^hash', | ||
href: 'http://localhost/test?query=string#hash', | ||
domain: 'http://localhost', | ||
isAbsolutePath: false, | ||
protocol: 'http:', | ||
host: 'localhost', | ||
hostname: 'localhost', | ||
port: '', | ||
}); | ||
}); | ||
}); | ||
|
||
describe('isSamePathname', () => { | ||
it('should return true for URLs with the same pathname', () => { | ||
expect( | ||
RouteUtils.isSamePathname('http://localhost/a', 'http://example.com/a') | ||
).toBe(true); | ||
}); | ||
|
||
it('should return false for URLs with different pathnames', () => { | ||
expect( | ||
RouteUtils.isSamePathname('http://localhost/a', 'http://example.com/b') | ||
).toBe(false); | ||
}); | ||
}); | ||
|
||
describe('createRouteMatcher', () => { | ||
it('should create a route matcher and match a given route', () => { | ||
const matcher = RouteUtils.createRouteMatcher('/test/:id'); | ||
expect(matcher.match('/test/123')).toEqual({ id: '123' }); | ||
}); | ||
}); | ||
}); |
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
Oops, something went wrong.