2023-03-14 13:18:55 +00:00
|
|
|
/**
|
|
|
|
* Copyright (c) HashiCorp, Inc.
|
2023-08-11 13:12:13 +00:00
|
|
|
* SPDX-License-Identifier: BUSL-1.1
|
2023-03-14 13:18:55 +00:00
|
|
|
*/
|
|
|
|
|
2018-08-29 09:00:15 +00:00
|
|
|
import { get as httpGet } from 'consul-ui/tests/helpers/api';
|
2022-09-15 08:43:17 +00:00
|
|
|
import { getProperties, set } from '@ember/object';
|
2018-08-29 09:00:15 +00:00
|
|
|
import measure from 'consul-ui/tests/helpers/measure';
|
|
|
|
|
2022-09-15 08:43:17 +00:00
|
|
|
/**
|
|
|
|
* A method that returns all attribute names for a given instance of an ember-data
|
|
|
|
* model. This is useful for when we want to get all properties of an ember-data
|
|
|
|
* model instance via `getProperties` without passing them explicitly.
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
*
|
|
|
|
* ```js
|
|
|
|
* // get all properties of a service instance
|
|
|
|
* return getProperties(service, recordAttributes(service))
|
|
|
|
* ```
|
|
|
|
*
|
|
|
|
* @param {*} record - an ember-data model instance
|
|
|
|
* @returns {string[]} An array of attribute names for the model instance
|
|
|
|
*/
|
|
|
|
function recordAttributes(record) {
|
|
|
|
const attributes = record.constructor.attributes;
|
|
|
|
|
|
|
|
return Array.from(attributes.keys());
|
|
|
|
}
|
|
|
|
|
2018-08-29 09:00:15 +00:00
|
|
|
/** Stub an ember-data adapter response using the private method
|
|
|
|
*
|
|
|
|
* Allows you to easily specify a HTTP response for the Adapter. The stub only works
|
|
|
|
* during the 'lifetime' of `cb` and is reset to normal unstubbed functionality afterwards.
|
|
|
|
*
|
|
|
|
* Please Note: This overwrites a private ember-data Adapter method, please understand
|
|
|
|
* the consequences of doing this if you are using it
|
|
|
|
*
|
|
|
|
* @param {function} cb - The callback, or test case, to run using the stubbed response
|
|
|
|
* @param {object} payload - The payload to use as the response
|
|
|
|
* @param {DS.Adapter} adapter - An instance of an ember-data Adapter
|
|
|
|
*/
|
2022-09-15 08:43:17 +00:00
|
|
|
const stubAdapterResponse = function (cb, payload, adapter) {
|
2018-08-29 09:00:15 +00:00
|
|
|
const payloadClone = JSON.parse(JSON.stringify(payload));
|
2022-09-15 08:43:17 +00:00
|
|
|
const client = adapter.client;
|
ui: UI Release Merge (ui-staging merge) (#6527)
## HTTPAdapter (#5637)
## Ember upgrade 2.18 > 3.12 (#6448)
### Proxies can no longer get away with not calling _super
This means that we can't use create anymore to define dynamic methods.
Therefore we dynamically make 2 extended Proxies on demand, and then
create from those. Therefore we can call _super in the init method of
the extended Proxies.
### We aren't allowed to reset a service anymore
We never actually need to now anyway, this is a remnant of the refactor
from browser based confirmations. We fix it as simply as possible here
but will revisit and remove the old browser confirm functionality at a
later date
### Revert classes to use ES5 style to workaround babel transp. probs
Using a mixture of ES6 classes (and hence super) and arrow functions
means that when babel transpiles the arrow functions down to ES5, a
reference to this is moved before the call to super, hence causing a js
error.
Furthermore, we the testing environment no longer lets use use
apply/call on the constructor.
These errors only manifests during testing (only in the testing
environment), the application itself runs fine with no problems without
this change.
Using ES5 style class definitions give us freedom to do all of the above
without causing any errors, so we reverted these classes back to ES5
class definitions
### Skip test that seems to have changed due to a change in RSVP timing
This test tests a usecase/area of the API that will probably never ever
be used, it was more testing out the API. We've skipped the test for now
as this doesn't affect the application itself, but left a note to come
back here later to investigate further
### Remove enumerableContentDidChange
Initial testing looks like we don't need to call this function anymore,
the function no longer exists
### Rework Changeset.isSaving to take into account new ember APIs
Setting/hanging a computedProperty of an instantiated object no longer
works. Move to setting it on the prototype/class definition instead
### Change how we detect whether something requires listening
New ember API's have changed how you can detect whether something is a
computedProperty or not. It's not immediately clear if its even possible
now. Therefore we change how we detect whether something should be
listened to or not by just looking for presence of `addEventListener`
### Potentially temporary change of ci test scripts to ensure deps exist
All our tooling scripts run through a Makefile (for people familiar with
only using those), which then call yarn scripts which can be called
independently (for people familar with only using yarn).
The Makefile targets always check to make sure all the dependencies are
installed before running anything that requires them (building, testing
etc).
The CI scripts/targets didn't follow this same route and called the yarn
scripts directly (usually CI builds a cache of the dependencies first).
For some reason this cache isn't doing what it usually does, and it
looks as though, in CI, ember isn't installed.
This commit makes the CI scripts consistently use the same method as all
of the other tooling scripts (Makefile target > Install Deps if
required > call yarn script). This should install the dependencies if
for some reason the CI cache building doesn't complete/isn't successful.
Potentially this commit may be reverted if, the root of the problem is
elsewhere, although consistency is always good, so it might be a good
idea to leave this commit as is even if we need to debug and fix things
elsewhere.
### Make test-parallel consistent with the rest of the tooling scripts
As we are here making changes for CI purposes (making test-ci
consistent), we spotted that test-parallel is also inconsistent and also
the README manual instructions won't work without `ember` installed
globally.
This commit makes everything consistent and changes the manual
instructions to use the local ember instance that gets installed via
yarn
### Re-wrangle catchable to fit with new ember 3.12 APIs
In the upgrade from ember 3.8 > 3.12 the public interfaces for
ComputedProperties have changed slightly. `meta` is no longer a public
property of ComputedProperty but of a ComputedDecoratorImpl mixin
instead.
https://github.com/emberjs/ember.js/blob/7e4ba1096e3c2e3e0dde186d5ca52ff19cb8720a/packages/%40ember/-internals/metal/lib/computed.ts#L725
There seems to be no way, by just using publically available
methods, to replicate this behaviour so that we can create our own
'ComputedProperty` factory via injecting the ComputedProperty class as
we did previously.
https://github.com/hashicorp/consul/blob/3f333bada181aaf6340523ca2268a28d1a7db214/ui-v2/app/utils/computed/factory.js#L1-L18
Instead we dynamically hang our `Catchable` `catch` method off the
instantiated ComputedProperty. In doing it like this `ComputedProperty`
has already has its `meta` method mixed in so we don't have to manually
mix it in ourselves (which doesn't seem possible)
This functionality is only used during our work in trying to ensure
our EventSource/BlockingQuery work was as 'ember-like' as possible (i.e.
using the traditional Route.model hooks and ember-like Controller
properties). Our ongoing/upcoming work on a componentized approach to
data a.k.a `<DataSource />` means we will be able to remove the majority
of the code involved here now that it seems to be under an amount of
flux in ember.
### Build bindata_assetfs.go with new UI changes
2019-09-30 13:47:49 +00:00
|
|
|
set(adapter, 'client', {
|
2022-09-15 08:43:17 +00:00
|
|
|
request: function (cb) {
|
|
|
|
return cb(function () {
|
ui: Adds Partitions to the HTTP layer (#10447)
This PR mainly adds partition to our HTTP adapter. Additionally and perhaps most importantly, we've also taken the opportunity to move our 'conditional namespaces' deeper into the app.
The reason for doing this was, we like that namespaces should be thought of as required instead of conditional, 'special' things and would like the same thinking to be applied to partitions.
Now, instead of using code throughout the app throughout the adapters to add/remove namespaces or partitions depending on whether they are enabled or not. As a UI engineer you just pretend that namespaces and partitions are always enabled, and we remove them for you deeper in the app, out of the way of you forgetting to treat these properties as a special case.
Notes:
Added a PartitionAbility while we were there (not used as yet)
Started to remove the CONSTANT variables we had just for property names. I prefer that our adapters are as readable and straightforwards as possible, it just looks like HTTP.
We'll probably remove our formatDatacenter method we use also at some point, it was mainly too make it look the same as our previous formatNspace, but now we don't have that, it instead now looks different!
We enable parsing of partition in the UIs URL, but this is feature flagged so still does nothing just yet.
All of the test changes were related to the fact that we were treating client.url as a function rather than a method, and now that we reference this in client.url (etc) it needs binding to client.
2021-09-15 17:09:55 +00:00
|
|
|
const params = client.requestParams(...arguments);
|
|
|
|
payload.headers['X-Consul-Namespace'] = params.data.ns || 'default';
|
2021-09-15 18:50:11 +00:00
|
|
|
payload.headers['X-Consul-Partition'] = params.data.partition || 'default';
|
2022-09-15 08:43:17 +00:00
|
|
|
return Promise.resolve(function (cb) {
|
ui: Adds Partitions to the HTTP layer (#10447)
This PR mainly adds partition to our HTTP adapter. Additionally and perhaps most importantly, we've also taken the opportunity to move our 'conditional namespaces' deeper into the app.
The reason for doing this was, we like that namespaces should be thought of as required instead of conditional, 'special' things and would like the same thinking to be applied to partitions.
Now, instead of using code throughout the app throughout the adapters to add/remove namespaces or partitions depending on whether they are enabled or not. As a UI engineer you just pretend that namespaces and partitions are always enabled, and we remove them for you deeper in the app, out of the way of you forgetting to treat these properties as a special case.
Notes:
Added a PartitionAbility while we were there (not used as yet)
Started to remove the CONSTANT variables we had just for property names. I prefer that our adapters are as readable and straightforwards as possible, it just looks like HTTP.
We'll probably remove our formatDatacenter method we use also at some point, it was mainly too make it look the same as our previous formatNspace, but now we don't have that, it instead now looks different!
We enable parsing of partition in the UIs URL, but this is feature flagged so still does nothing just yet.
All of the test changes were related to the fact that we were treating client.url as a function rather than a method, and now that we reference this in client.url (etc) it needs binding to client.
2021-09-15 17:09:55 +00:00
|
|
|
return cb(payload.headers, payloadClone.payload);
|
ui: UI Release Merge (ui-staging merge) (#6527)
## HTTPAdapter (#5637)
## Ember upgrade 2.18 > 3.12 (#6448)
### Proxies can no longer get away with not calling _super
This means that we can't use create anymore to define dynamic methods.
Therefore we dynamically make 2 extended Proxies on demand, and then
create from those. Therefore we can call _super in the init method of
the extended Proxies.
### We aren't allowed to reset a service anymore
We never actually need to now anyway, this is a remnant of the refactor
from browser based confirmations. We fix it as simply as possible here
but will revisit and remove the old browser confirm functionality at a
later date
### Revert classes to use ES5 style to workaround babel transp. probs
Using a mixture of ES6 classes (and hence super) and arrow functions
means that when babel transpiles the arrow functions down to ES5, a
reference to this is moved before the call to super, hence causing a js
error.
Furthermore, we the testing environment no longer lets use use
apply/call on the constructor.
These errors only manifests during testing (only in the testing
environment), the application itself runs fine with no problems without
this change.
Using ES5 style class definitions give us freedom to do all of the above
without causing any errors, so we reverted these classes back to ES5
class definitions
### Skip test that seems to have changed due to a change in RSVP timing
This test tests a usecase/area of the API that will probably never ever
be used, it was more testing out the API. We've skipped the test for now
as this doesn't affect the application itself, but left a note to come
back here later to investigate further
### Remove enumerableContentDidChange
Initial testing looks like we don't need to call this function anymore,
the function no longer exists
### Rework Changeset.isSaving to take into account new ember APIs
Setting/hanging a computedProperty of an instantiated object no longer
works. Move to setting it on the prototype/class definition instead
### Change how we detect whether something requires listening
New ember API's have changed how you can detect whether something is a
computedProperty or not. It's not immediately clear if its even possible
now. Therefore we change how we detect whether something should be
listened to or not by just looking for presence of `addEventListener`
### Potentially temporary change of ci test scripts to ensure deps exist
All our tooling scripts run through a Makefile (for people familiar with
only using those), which then call yarn scripts which can be called
independently (for people familar with only using yarn).
The Makefile targets always check to make sure all the dependencies are
installed before running anything that requires them (building, testing
etc).
The CI scripts/targets didn't follow this same route and called the yarn
scripts directly (usually CI builds a cache of the dependencies first).
For some reason this cache isn't doing what it usually does, and it
looks as though, in CI, ember isn't installed.
This commit makes the CI scripts consistently use the same method as all
of the other tooling scripts (Makefile target > Install Deps if
required > call yarn script). This should install the dependencies if
for some reason the CI cache building doesn't complete/isn't successful.
Potentially this commit may be reverted if, the root of the problem is
elsewhere, although consistency is always good, so it might be a good
idea to leave this commit as is even if we need to debug and fix things
elsewhere.
### Make test-parallel consistent with the rest of the tooling scripts
As we are here making changes for CI purposes (making test-ci
consistent), we spotted that test-parallel is also inconsistent and also
the README manual instructions won't work without `ember` installed
globally.
This commit makes everything consistent and changes the manual
instructions to use the local ember instance that gets installed via
yarn
### Re-wrangle catchable to fit with new ember 3.12 APIs
In the upgrade from ember 3.8 > 3.12 the public interfaces for
ComputedProperties have changed slightly. `meta` is no longer a public
property of ComputedProperty but of a ComputedDecoratorImpl mixin
instead.
https://github.com/emberjs/ember.js/blob/7e4ba1096e3c2e3e0dde186d5ca52ff19cb8720a/packages/%40ember/-internals/metal/lib/computed.ts#L725
There seems to be no way, by just using publically available
methods, to replicate this behaviour so that we can create our own
'ComputedProperty` factory via injecting the ComputedProperty class as
we did previously.
https://github.com/hashicorp/consul/blob/3f333bada181aaf6340523ca2268a28d1a7db214/ui-v2/app/utils/computed/factory.js#L1-L18
Instead we dynamically hang our `Catchable` `catch` method off the
instantiated ComputedProperty. In doing it like this `ComputedProperty`
has already has its `meta` method mixed in so we don't have to manually
mix it in ourselves (which doesn't seem possible)
This functionality is only used during our work in trying to ensure
our EventSource/BlockingQuery work was as 'ember-like' as possible (i.e.
using the traditional Route.model hooks and ember-like Controller
properties). Our ongoing/upcoming work on a componentized approach to
data a.k.a `<DataSource />` means we will be able to remove the majority
of the code involved here now that it seems to be under an amount of
flux in ember.
### Build bindata_assetfs.go with new UI changes
2019-09-30 13:47:49 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
});
|
2022-09-15 08:43:17 +00:00
|
|
|
return cb(payload.payload).then(function (result) {
|
ui: UI Release Merge (ui-staging merge) (#6527)
## HTTPAdapter (#5637)
## Ember upgrade 2.18 > 3.12 (#6448)
### Proxies can no longer get away with not calling _super
This means that we can't use create anymore to define dynamic methods.
Therefore we dynamically make 2 extended Proxies on demand, and then
create from those. Therefore we can call _super in the init method of
the extended Proxies.
### We aren't allowed to reset a service anymore
We never actually need to now anyway, this is a remnant of the refactor
from browser based confirmations. We fix it as simply as possible here
but will revisit and remove the old browser confirm functionality at a
later date
### Revert classes to use ES5 style to workaround babel transp. probs
Using a mixture of ES6 classes (and hence super) and arrow functions
means that when babel transpiles the arrow functions down to ES5, a
reference to this is moved before the call to super, hence causing a js
error.
Furthermore, we the testing environment no longer lets use use
apply/call on the constructor.
These errors only manifests during testing (only in the testing
environment), the application itself runs fine with no problems without
this change.
Using ES5 style class definitions give us freedom to do all of the above
without causing any errors, so we reverted these classes back to ES5
class definitions
### Skip test that seems to have changed due to a change in RSVP timing
This test tests a usecase/area of the API that will probably never ever
be used, it was more testing out the API. We've skipped the test for now
as this doesn't affect the application itself, but left a note to come
back here later to investigate further
### Remove enumerableContentDidChange
Initial testing looks like we don't need to call this function anymore,
the function no longer exists
### Rework Changeset.isSaving to take into account new ember APIs
Setting/hanging a computedProperty of an instantiated object no longer
works. Move to setting it on the prototype/class definition instead
### Change how we detect whether something requires listening
New ember API's have changed how you can detect whether something is a
computedProperty or not. It's not immediately clear if its even possible
now. Therefore we change how we detect whether something should be
listened to or not by just looking for presence of `addEventListener`
### Potentially temporary change of ci test scripts to ensure deps exist
All our tooling scripts run through a Makefile (for people familiar with
only using those), which then call yarn scripts which can be called
independently (for people familar with only using yarn).
The Makefile targets always check to make sure all the dependencies are
installed before running anything that requires them (building, testing
etc).
The CI scripts/targets didn't follow this same route and called the yarn
scripts directly (usually CI builds a cache of the dependencies first).
For some reason this cache isn't doing what it usually does, and it
looks as though, in CI, ember isn't installed.
This commit makes the CI scripts consistently use the same method as all
of the other tooling scripts (Makefile target > Install Deps if
required > call yarn script). This should install the dependencies if
for some reason the CI cache building doesn't complete/isn't successful.
Potentially this commit may be reverted if, the root of the problem is
elsewhere, although consistency is always good, so it might be a good
idea to leave this commit as is even if we need to debug and fix things
elsewhere.
### Make test-parallel consistent with the rest of the tooling scripts
As we are here making changes for CI purposes (making test-ci
consistent), we spotted that test-parallel is also inconsistent and also
the README manual instructions won't work without `ember` installed
globally.
This commit makes everything consistent and changes the manual
instructions to use the local ember instance that gets installed via
yarn
### Re-wrangle catchable to fit with new ember 3.12 APIs
In the upgrade from ember 3.8 > 3.12 the public interfaces for
ComputedProperties have changed slightly. `meta` is no longer a public
property of ComputedProperty but of a ComputedDecoratorImpl mixin
instead.
https://github.com/emberjs/ember.js/blob/7e4ba1096e3c2e3e0dde186d5ca52ff19cb8720a/packages/%40ember/-internals/metal/lib/computed.ts#L725
There seems to be no way, by just using publically available
methods, to replicate this behaviour so that we can create our own
'ComputedProperty` factory via injecting the ComputedProperty class as
we did previously.
https://github.com/hashicorp/consul/blob/3f333bada181aaf6340523ca2268a28d1a7db214/ui-v2/app/utils/computed/factory.js#L1-L18
Instead we dynamically hang our `Catchable` `catch` method off the
instantiated ComputedProperty. In doing it like this `ComputedProperty`
has already has its `meta` method mixed in so we don't have to manually
mix it in ourselves (which doesn't seem possible)
This functionality is only used during our work in trying to ensure
our EventSource/BlockingQuery work was as 'ember-like' as possible (i.e.
using the traditional Route.model hooks and ember-like Controller
properties). Our ongoing/upcoming work on a componentized approach to
data a.k.a `<DataSource />` means we will be able to remove the majority
of the code involved here now that it seems to be under an amount of
flux in ember.
### Build bindata_assetfs.go with new UI changes
2019-09-30 13:47:49 +00:00
|
|
|
set(adapter, 'client', client);
|
2018-08-29 09:00:15 +00:00
|
|
|
return result;
|
|
|
|
});
|
|
|
|
};
|
|
|
|
/** `repo` a helper function to faciliate easy integration testing of ember-data Service 'repo' layers
|
|
|
|
*
|
|
|
|
* Test performance is also measured using `consul-ui/tests/helpers/measure` and therefore results
|
|
|
|
* can optionally be sent to a centralized metrics collection stack
|
|
|
|
*
|
|
|
|
* @param {string} name - The name of your repo Service (only used for meta purposes)
|
|
|
|
* @param {string} payload - The method you are testing (only used for meta purposes)
|
|
|
|
* @param {Service} service - An instance of an ember-data based repo Service
|
|
|
|
* @param {function} stub - A function that receives a `stub` function allowing you to stub
|
|
|
|
* an API endpoint with a set of cookies/env vars used by the double
|
|
|
|
* @param {function} test - Your test case. This function receives an instance of the Service provided
|
|
|
|
* above as a first and only argument, it should return the result of your test
|
|
|
|
* @param {function} assert - Your assertion. This receives the result of the previous function as the first
|
|
|
|
* argument and a function to that receives the stubbed payload giving you an
|
|
|
|
* opportunity to mutate it before returning for use in your assertion
|
|
|
|
*/
|
2022-09-15 08:43:17 +00:00
|
|
|
export default function (name, method, service, stub, test, assert) {
|
|
|
|
const adapter = service.store.adapterFor(name.toLowerCase());
|
2018-08-29 09:00:15 +00:00
|
|
|
let tags = {};
|
2022-09-15 08:43:17 +00:00
|
|
|
const requestHeaders = function (url, cookies = {}) {
|
|
|
|
const key = Object.keys(cookies).find(function (item) {
|
2018-08-29 09:00:15 +00:00
|
|
|
return item.indexOf('COUNT') !== -1;
|
|
|
|
});
|
|
|
|
tags = {
|
|
|
|
count: typeof key !== 'undefined' ? parseInt(cookies[key]) : 1,
|
|
|
|
};
|
|
|
|
return httpGet(url, {
|
|
|
|
headers: {
|
|
|
|
cookie: cookies,
|
|
|
|
},
|
2022-09-15 08:43:17 +00:00
|
|
|
}).then(function (payload) {
|
ui: Adds Partitions to the HTTP layer (#10447)
This PR mainly adds partition to our HTTP adapter. Additionally and perhaps most importantly, we've also taken the opportunity to move our 'conditional namespaces' deeper into the app.
The reason for doing this was, we like that namespaces should be thought of as required instead of conditional, 'special' things and would like the same thinking to be applied to partitions.
Now, instead of using code throughout the app throughout the adapters to add/remove namespaces or partitions depending on whether they are enabled or not. As a UI engineer you just pretend that namespaces and partitions are always enabled, and we remove them for you deeper in the app, out of the way of you forgetting to treat these properties as a special case.
Notes:
Added a PartitionAbility while we were there (not used as yet)
Started to remove the CONSTANT variables we had just for property names. I prefer that our adapters are as readable and straightforwards as possible, it just looks like HTTP.
We'll probably remove our formatDatacenter method we use also at some point, it was mainly too make it look the same as our previous formatNspace, but now we don't have that, it instead now looks different!
We enable parsing of partition in the UIs URL, but this is feature flagged so still does nothing just yet.
All of the test changes were related to the fact that we were treating client.url as a function rather than a method, and now that we reference this in client.url (etc) it needs binding to client.
2021-09-15 17:09:55 +00:00
|
|
|
return {
|
|
|
|
headers: {},
|
|
|
|
payload: payload,
|
|
|
|
};
|
2018-08-29 09:00:15 +00:00
|
|
|
});
|
|
|
|
};
|
2022-09-15 08:43:17 +00:00
|
|
|
|
|
|
|
const parseResponse = function (response) {
|
2018-08-29 09:00:15 +00:00
|
|
|
let actual;
|
2022-09-15 08:43:17 +00:00
|
|
|
// we are dealing with a record-array
|
2018-08-29 09:00:15 +00:00
|
|
|
if (typeof response.toArray === 'function') {
|
2022-09-15 08:43:17 +00:00
|
|
|
actual = response.toArray().map(function (item) {
|
|
|
|
return getProperties(item, recordAttributes(item));
|
2018-08-29 09:00:15 +00:00
|
|
|
});
|
|
|
|
} else {
|
2022-09-15 08:43:17 +00:00
|
|
|
// we are dealing with a single record
|
2018-08-29 09:00:15 +00:00
|
|
|
if (typeof response.get === 'function') {
|
2022-09-15 08:43:17 +00:00
|
|
|
const data = response.data;
|
|
|
|
|
|
|
|
if (data) {
|
|
|
|
// we were dealing with a proxy
|
|
|
|
actual = data;
|
|
|
|
} else {
|
|
|
|
// we are dealing with a model instance we need to iterate attributes
|
|
|
|
actual = getProperties(response, recordAttributes(response));
|
|
|
|
}
|
2018-08-29 09:00:15 +00:00
|
|
|
} else {
|
|
|
|
actual = response;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return actual;
|
|
|
|
};
|
2022-09-15 08:43:17 +00:00
|
|
|
return stub(requestHeaders).then(function (payload) {
|
2018-08-29 09:00:15 +00:00
|
|
|
return stubAdapterResponse(
|
2022-09-15 08:43:17 +00:00
|
|
|
function (payload) {
|
2018-08-29 09:00:15 +00:00
|
|
|
return measure(
|
2022-09-15 08:43:17 +00:00
|
|
|
function () {
|
2018-08-29 09:00:15 +00:00
|
|
|
return test(service);
|
|
|
|
},
|
|
|
|
`${name}Service.${method}`,
|
|
|
|
tags
|
2022-09-15 08:43:17 +00:00
|
|
|
).then(function (response) {
|
|
|
|
assert(parseResponse(response), function (cb) {
|
2018-08-29 09:00:15 +00:00
|
|
|
return cb(payload);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
payload,
|
|
|
|
adapter
|
|
|
|
);
|
|
|
|
});
|
|
|
|
}
|