-
Notifications
You must be signed in to change notification settings - Fork 243
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
Asad Memon
committed
Jun 21, 2019
1 parent
e83e4e5
commit 74ff544
Showing
18 changed files
with
248 additions
and
57 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
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,50 @@ | ||
const { get } = require("../request"); | ||
// const cheerio = require("cheerio"); | ||
|
||
test("Dynamic in root", () => { | ||
return get("/rootdynamicpath", { json: true }).then(data => { | ||
expect(data.rootParam).toBe("rootdynamicpath"); | ||
}); | ||
}); | ||
|
||
test("Non-dynamic index sibling", () => { | ||
return get("/dynamicpaths", { json: true }).then(data => { | ||
expect(data.index).toBe(true); | ||
}); | ||
}); | ||
|
||
test("Dynamic path with param", () => { | ||
return get("/dynamicpaths/param1", { json: true }).then(data => { | ||
expect(data.param).toBe("param1"); | ||
}); | ||
}); | ||
|
||
test("Dynamic path's static sibling", () => { | ||
return get("/dynamicpaths/static", { json: true }).then(data => { | ||
expect(data.static).toBe(true); | ||
}); | ||
}); | ||
|
||
test("Dynamic path with param and nested index", () => { | ||
return get("/dynamicpaths/param1/nested", { json: true }).then(data => { | ||
expect(data.nestedIndex).toBe(true); | ||
}); | ||
}); | ||
|
||
test("Dynamic path with param and nested param", () => { | ||
return get("/dynamicpaths/param1/nested/nestedParam1", { json: true }).then( | ||
data => { | ||
expect( | ||
data.param === "param1" && data.nestedParam === "nestedParam1" | ||
).toBe(true); | ||
} | ||
); | ||
}); | ||
|
||
test("Dynamic path with param and nested static as a sibling to nested param", () => { | ||
return get("/dynamicpaths/param1/nested/anotherStatic", { json: true }).then( | ||
data => { | ||
expect(data.anotherStatic).toBe(true); | ||
} | ||
); | ||
}); |
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,3 @@ | ||
module.exports = (req, res)=>{ | ||
res.send({rootParam: req.params.rootParam}) | ||
} |
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,3 @@ | ||
module.exports = (req, res)=>{ | ||
res.send({param: req.params.param}) | ||
} |
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,3 @@ | ||
module.exports = (req, res)=>{ | ||
res.send({param: req.params.param, nestedParam: req.params.nestedParam}) | ||
} |
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,3 @@ | ||
module.exports = (req, res)=>{ | ||
res.send({anotherStatic: true}) | ||
} |
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,3 @@ | ||
module.exports = (req, res)=>{ | ||
res.send({nestedIndex: true}) | ||
} |
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,3 @@ | ||
module.exports = (req, res)=>{ | ||
res.send({index: true}) | ||
} |
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,5 @@ | ||
from flask import jsonify | ||
def handler(nestedParam): | ||
return jsonify( | ||
nestedParam=nestedParam | ||
) |
Oops, something went wrong.