bug(deeplinking): escaping breaks whitespaces & underscored tags/ids (via #4953)

* add tests for operation lacking an operationId
* add deep linking tests for tags/operationIds with underscores
* migrate from `_` to `%20` for deeplink hash whitespace escaping
* add backwards compatibility for `_` whitespace escaping
* update util unit tests
This commit is contained in:
kyle
2018-10-16 18:51:29 -05:00
committed by GitHub
parent 94b1355700
commit 3c3b7e0bf1
7 changed files with 231 additions and 12 deletions

View File

@@ -991,12 +991,12 @@ describe("utils", function() {
describe("createDeepLinkPath", function() {
it("creates a deep link path replacing spaces with underscores", function() {
const result = createDeepLinkPath("tag id with spaces")
expect(result).toEqual("tag_id_with_spaces")
expect(result).toEqual("tag%20id%20with%20spaces")
})
it("trims input when creating a deep link path", function() {
let result = createDeepLinkPath(" spaces before and after ")
expect(result).toEqual("spaces_before_and_after")
expect(result).toEqual("spaces%20before%20and%20after")
result = createDeepLinkPath(" ")
expect(result).toEqual("")
@@ -1036,6 +1036,16 @@ describe("utils", function() {
const result = escapeDeepLinkPath("hello#world")
expect(result).toEqual("hello\\#world")
})
it("escapes a deep link path with a space", function() {
const result = escapeDeepLinkPath("hello world")
expect(result).toEqual("hello_world")
})
it("escapes a deep link path with a percent-encoded space", function() {
const result = escapeDeepLinkPath("hello%20world")
expect(result).toEqual("hello_world")
})
})
describe("getExtensions", function() {