improve error reporting in test case

This commit is contained in:
Florian Dold 2021-04-08 16:03:04 +02:00
parent 4fa88007f9
commit b2edad2dac
No known key found for this signature in database
GPG Key ID: D2E4F00F29D02A4B

View File

@ -17,7 +17,6 @@
/** /**
* Imports. * Imports.
*/ */
import { URL } from "@gnu-taler/taler-wallet-core";
import axios from "axios"; import axios from "axios";
import { import {
ExchangeService, ExchangeService,
@ -62,14 +61,6 @@ export async function runMerchantInstancesUrlsTest(t: GlobalTestState) {
}, },
); );
const clientForMyinst = new MerchantApiClient(
merchant.makeInstanceBaseUrl("myinst"),
{
method: "token",
token: "secret-token:i-am-myinst",
},
);
await clientForDefault.createInstance({ await clientForDefault.createInstance({
id: "default", id: "default",
address: {}, address: {},
@ -111,12 +102,13 @@ export async function runMerchantInstancesUrlsTest(t: GlobalTestState) {
}, },
validateStatus: () => true, validateStatus: () => true,
}); });
console.log("checking", url); console.log(
`checking ${url}, expected ${expectedStatus}, got ${resp.status}`,
);
t.assertDeepEqual(resp.status, expectedStatus); t.assertDeepEqual(resp.status, expectedStatus);
} }
const tokDefault = "secret-token:i-am-default"; const tokDefault = "secret-token:i-am-default";
const tokMyinst = "secret-token:i-am-myinst";
const defaultBaseUrl = merchant.makeInstanceBaseUrl(); const defaultBaseUrl = merchant.makeInstanceBaseUrl();
@ -135,11 +127,7 @@ export async function runMerchantInstancesUrlsTest(t: GlobalTestState) {
); );
// Non-default instances don't allow instance management. // Non-default instances don't allow instance management.
await check( await check(`${defaultBaseUrl}instances/foo/private/instances`, "foo", 404);
`${defaultBaseUrl}instances/foo/private/instances`,
"foo",
404,
);
await check( await check(
`${defaultBaseUrl}instances/myinst/private/instances`, `${defaultBaseUrl}instances/myinst/private/instances`,
"foo", "foo",