mirror of
https://github.com/status-im/consul.git
synced 2025-01-30 07:26:19 +00:00
9d21736e9f
* Add copyright headers to UI files * Ensure copywrite file ignores external libs
30 lines
963 B
JavaScript
30 lines
963 B
JavaScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: MPL-2.0
|
|
*/
|
|
|
|
export default function (scenario, respondWith, set, oidc) {
|
|
// respondWith should set the url to return a certain response shape
|
|
scenario
|
|
.given(['the url "$endpoint" responds with a $status status'], function (url, status) {
|
|
respondWith(url, {
|
|
status: parseInt(status),
|
|
});
|
|
})
|
|
.given(['the url "$endpoint" responds with from yaml\n$yaml'], function (url, data) {
|
|
if (typeof data.body !== 'string') {
|
|
data.body = JSON.stringify(data.body);
|
|
}
|
|
respondWith(url, data);
|
|
})
|
|
.given(['the "$provider" oidcProvider responds with from yaml\n$yaml'], function (name, data) {
|
|
oidc(name, data);
|
|
})
|
|
.given('a network latency of $number', function (number) {
|
|
set('CONSUL_LATENCY', number);
|
|
})
|
|
.given('an API prefix of "$prefix"', function (prefix) {
|
|
set('CONSUL_API_PREFIX', prefix);
|
|
});
|
|
}
|