2018-10-16 02:29:12 +03:00
|
|
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
|
|
// Licensed under the MIT License. See License.txt in the project root for license information.
|
|
|
|
|
2020-11-24 06:07:36 +03:00
|
|
|
import * as assert from "assert";
|
2018-10-16 02:29:12 +03:00
|
|
|
|
2020-11-24 06:07:36 +03:00
|
|
|
import { validateExamples } from "../lib/validate";
|
2019-03-09 02:38:37 +03:00
|
|
|
|
2018-10-16 02:29:12 +03:00
|
|
|
describe("error info", () => {
|
|
|
|
it("error info should contain url to file", async () => {
|
2019-01-15 03:44:53 +03:00
|
|
|
try {
|
|
|
|
const result = await validateExamples(
|
|
|
|
"./test/modelValidation/swaggers/specification/errorInfo/apimusers.json",
|
|
|
|
undefined,
|
|
|
|
{
|
2020-11-24 06:07:36 +03:00
|
|
|
consoleLogLevel: "off",
|
2019-01-15 03:44:53 +03:00
|
|
|
}
|
2020-11-24 06:07:36 +03:00
|
|
|
);
|
|
|
|
assert.strictEqual(result.length, 2);
|
2021-10-20 08:42:57 +03:00
|
|
|
const r = result[0] as any;
|
2019-01-15 03:44:53 +03:00
|
|
|
assert.strictEqual(
|
2021-10-20 08:42:57 +03:00
|
|
|
r.schemaUrl,
|
2019-01-15 03:44:53 +03:00
|
|
|
"./test/modelValidation/swaggers/specification/errorInfo/apimusers.json"
|
2020-11-24 06:07:36 +03:00
|
|
|
);
|
2019-01-15 03:44:53 +03:00
|
|
|
} catch (e) {
|
2020-11-24 06:07:36 +03:00
|
|
|
assert.fail(e);
|
2019-01-15 03:44:53 +03:00
|
|
|
}
|
2020-11-24 06:07:36 +03:00
|
|
|
});
|
|
|
|
});
|