Add tests that break when you request a folder without a trailing slash
This commit is contained in:
parent
488c147ade
commit
c5b2e17f04
19
ui-v2/tests/acceptance/dc/kvs/trailing-slash.feature
Normal file
19
ui-v2/tests/acceptance/dc/kvs/trailing-slash.feature
Normal file
|
@ -0,0 +1,19 @@
|
|||
@setupApplicationTest
|
||||
Feature: dc / kvs / trailing slash
|
||||
Scenario: I have 10 folders
|
||||
Given 1 datacenter model with the value "datacenter"
|
||||
And 10 kv models from yaml
|
||||
When I visit the kvs page for yaml
|
||||
---
|
||||
dc: datacenter
|
||||
kv: foo/bar
|
||||
---
|
||||
Then the url should be /datacenter/kv/foo/bar
|
||||
And the last GET request was made to "/v1/kv/foo/bar/?keys&dc=datacenter&separator=%2F"
|
||||
When I visit the kvs page for yaml
|
||||
---
|
||||
dc: datacenter
|
||||
kv: foo/bar/
|
||||
---
|
||||
Then the url should be /datacenter/kv/foo/bar/
|
||||
And the last GET request was made to "/v1/kv/foo/bar/?keys&dc=datacenter&separator=%2F"
|
10
ui-v2/tests/acceptance/steps/dc/kvs/trailing-slash-steps.js
Normal file
10
ui-v2/tests/acceptance/steps/dc/kvs/trailing-slash-steps.js
Normal file
|
@ -0,0 +1,10 @@
|
|||
import steps from '../../steps';
|
||||
|
||||
// step definitions that are shared between features should be moved to the
|
||||
// tests/acceptance/steps/steps.js file
|
||||
|
||||
export default function(assert) {
|
||||
return steps(assert).then('I should find a file', function() {
|
||||
assert.ok(true, this.step);
|
||||
});
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
export default function(visitable, deletable, creatable, clickable, attribute, collection) {
|
||||
return creatable({
|
||||
visit: visitable('/:dc/kv'),
|
||||
visit: visitable(['/:dc/kv/:kv', '/:dc/kv'], str => str),
|
||||
kvs: collection(
|
||||
'[data-test-tabular-row]',
|
||||
deletable({
|
||||
|
|
|
@ -241,6 +241,15 @@ export default function(assert) {
|
|||
);
|
||||
assert.equal(request.url, url, `Expected the request url to be ${url}, was ${request.url}`);
|
||||
})
|
||||
.then('the last $method request was made to "$url"', function(method, url) {
|
||||
const request = api.server.history
|
||||
.slice(0)
|
||||
.reverse()
|
||||
.find(function(item) {
|
||||
return item.method === method;
|
||||
});
|
||||
assert.equal(request.url, url, `Expected the request url to be ${url}, was ${request.url}`);
|
||||
})
|
||||
.then('the url should be $url', function(url) {
|
||||
// TODO: nice! $url should be wrapped in ""
|
||||
if (url === "''") {
|
||||
|
|
Loading…
Reference in a new issue