-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: utils relative path
- Loading branch information
Showing
11 changed files
with
100 additions
and
44 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { MethodKind } from '../../src/models/kinds/MethodKind'; | ||
import { MethodOperation } from '../../src/models/kinds/MethodOperation'; | ||
import { ParameterPlace } from '../../src/models/kinds/ParameterPlace'; | ||
import { PropertyKind } from '../../src/models/kinds/PropertyKind'; | ||
import { IMethodModel } from '../../src/models/method-parameter/IMethodModel'; | ||
import { PathBuilder } from '../../src/services/PathBuilder'; | ||
|
||
describe('UriBuilder tests', () => { | ||
let pathBuilder: PathBuilder; | ||
beforeEach(() => (pathBuilder = new PathBuilder())); | ||
|
||
describe('normalizePath', () => { | ||
describe('return correct path', () => { | ||
test('path with double slash', () => { | ||
// Arrange | ||
const firstPart = './folder1/folder2/'; | ||
const secondPart = '/folder3/folder4/'; | ||
const path = `${firstPart}/${secondPart}`; | ||
|
||
const expected = './folder1/folder2/folder3/folder4'; | ||
|
||
// Act | ||
const result = pathBuilder.normalizePath(path); | ||
|
||
// Assert | ||
expect(result).toEqual(expected); | ||
}); | ||
}); | ||
}); | ||
}); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export class PathBuilder { | ||
public normalizePath(path: string): string { | ||
return path | ||
.split('/') | ||
.filter((x) => x) | ||
.join('/'); | ||
} | ||
} |