test: update test files

This commit is contained in:
Michel Jonathan Schmitz
2020-05-13 08:47:30 +02:00
parent d30de896f0
commit 9f9167c9c7
3 changed files with 56 additions and 19 deletions

View File

@@ -98,7 +98,7 @@ export class ClientSpec {
}
@test
async constructWithVersion() {
async constructWithHeaders() {
sandbox.on(httpClient, 'request', invokeIndexRoute);
expect(httpClient.request).not.to.have.been.first.called();
@@ -109,6 +109,7 @@ export class ClientSpec {
expect(httpClient.request).to.have.been.first.called.with({
body: {},
headers: {
'Content-Type': 'application/json',
'X-StApps-Version': 'foo.foo.foo',
},
method: indexRoute.method,
@@ -156,7 +157,9 @@ export class ClientSpec {
expect(httpClient.request).to.have.been.first.called.with({
body: feedback,
headers: {},
headers: {
"Content-Type": "application/json",
},
method: feedbackRoute.method,
url: new URL('http://localhost' + feedbackRoute.getUrlFragment()),
});
@@ -214,7 +217,9 @@ export class ClientSpec {
},
size: 1,
},
headers: {},
headers: {
"Content-Type": "application/json",
},
method: searchRoute.method,
url: new URL('http://localhost' + searchRoute.getUrlFragment()),
});
@@ -302,7 +307,9 @@ export class ClientSpec {
expect(httpClient.request).to.have.been.first.called.with({
body: {},
headers: {},
headers: {
"Content-Type": "application/json",
},
method: indexRoute.method,
url: new URL('http://localhost' + indexRoute.getUrlFragment()),
});
@@ -330,7 +337,9 @@ export class ClientSpec {
expect(httpClient.request).to.have.been.first.called.with({
body: undefined,
headers: {},
headers: {
"Content-Type": "application/json",
},
method: indexRoute.method,
url: new URL('http://localhost' + indexRoute.getUrlFragment()),
});
@@ -389,7 +398,9 @@ export class ClientSpec {
expect(httpClient.request).to.have.been.first.called.with({
body: {a: {size: 1}, b: {size: 1}},
headers: {},
headers: {
"Content-Type": "application/json",
},
method: multiSearchRoute.method,
url: new URL('http://localhost' + multiSearchRoute.getUrlFragment()),
});
@@ -437,13 +448,17 @@ export class ClientSpec {
expect(httpClient.request).to.have.been.first.called.with({
body: {foo: {size: 0}, bar: {size: 0}},
headers: {},
headers: {
"Content-Type": "application/json",
},
method: multiSearchRoute.method,
url: new URL('http://localhost' + multiSearchRoute.getUrlFragment()),
});
expect(httpClient.request).to.have.been.second.called.with({
body: {foo: {size: 1000}, bar: {size: 500}, foobar: {size: 30}},
headers: {},
headers: {
"Content-Type": "application/json",
},
method: multiSearchRoute.method,
url: new URL('http://localhost' + multiSearchRoute.getUrlFragment()),
});
@@ -504,7 +519,9 @@ export class ClientSpec {
expect(httpClient.request).to.have.been.first.called.with({
body: {size: 1},
headers: {},
headers: {
"Content-Type": "application/json",
},
method: searchRoute.method,
url: new URL('http://localhost' + searchRoute.getUrlFragment()),
});
@@ -540,7 +557,9 @@ export class ClientSpec {
expect(httpClient.request).to.have.been.first.called.with({
body: {from: 30, size: 30},
headers: {},
headers: {
"Content-Type": "application/json",
},
method: searchRoute.method,
url: new URL('http://localhost' + searchRoute.getUrlFragment()),
});
@@ -574,13 +593,17 @@ export class ClientSpec {
expect(httpClient.request).to.have.been.first.called.with({
body: {size: 0},
headers: {},
headers: {
"Content-Type": "application/json",
},
method: searchRoute.method,
url: new URL('http://localhost' + searchRoute.getUrlFragment()),
});
expect(httpClient.request).to.have.been.second.called.with({
body: {size: 1000},
headers: {},
headers: {
"Content-Type": "application/json",
},
method: searchRoute.method,
url: new URL('http://localhost' + searchRoute.getUrlFragment()),
});

View File

@@ -109,7 +109,9 @@ export class ConnectorClientSpec {
source: 'foo',
type: SCThingType.Message,
},
headers: {},
headers: {
"Content-Type": "application/json",
},
method: bulkRoute.method,
url: new URL('http://localhost' + bulkRoute.getUrlFragment()),
});
@@ -142,7 +144,9 @@ export class ConnectorClientSpec {
source: 'foo',
type: SCThingType.Message,
},
headers: {},
headers: {
"Content-Type": "application/json",
},
method: bulkRoute.method,
url: new URL('http://localhost' + bulkRoute.getUrlFragment()),
});
@@ -223,7 +227,9 @@ export class ConnectorClientSpec {
source: 'copy',
type: SCThingType.Message,
},
headers: {},
headers: {
"Content-Type": "application/json",
},
method: bulkRoute.method,
url: new URL('http://localhost' + bulkRoute.getUrlFragment()),
});
@@ -310,7 +316,9 @@ export class ConnectorClientSpec {
source: 'stapps-api',
type: SCThingType.Message,
},
headers: {},
headers: {
"Content-Type": "application/json",
},
method: bulkRoute.method,
url: new URL('http://localhost' + bulkRoute.getUrlFragment()),
});
@@ -429,7 +437,9 @@ export class ConnectorClientSpec {
expect(httpClient.request).to.have.been.called.with({
body: message,
headers: {},
headers: {
"Content-Type": "application/json",
},
method: thingUpdateRoute.method,
url: new URL('http://localhost' + thingUpdateRoute.getUrlFragment({
TYPE: SCThingType.Message,

View File

@@ -77,7 +77,9 @@ export class PluginClientSpec {
expect(httpClient.request).to.have.been.first.called.with({
body: request,
headers: {},
headers: {
"Content-Type": "application/json",
},
method: pluginRegisterRoute.method,
url: new URL(`http://localhost${pluginRegisterRoute.getUrlFragment()}`),
});
@@ -106,7 +108,9 @@ export class PluginClientSpec {
expect(httpClient.request).to.have.been.first.called.with({
body: request,
headers: {},
headers: {
"Content-Type": "application/json",
},
method: pluginRegisterRoute.method,
url: new URL(`http://localhost${pluginRegisterRoute.getUrlFragment()}`),
});