fixed failing test while fetching getDags

Signed-off-by: Daniele.Mazzotta <daniele.mazzotta@tii.ae>
This commit is contained in:
Daniele.Mazzotta
2022-06-23 10:29:10 +04:00
parent 007cba9eb1
commit aed6b691cb
2 changed files with 10 additions and 1 deletions
@@ -107,6 +107,15 @@ describe('ApacheAirflowClient', () => {
);
}),
rest.get(`${mockBaseUrl}/airflow/dags/:dag_id`, (req, res, ctx) => {
const { dag_id } = req.params;
const dag = dags.find(d => d.dag_id === dag_id);
if (dag) {
return res(ctx.json(dag));
}
return res(ctx.status(404));
}),
rest.patch(`${mockBaseUrl}/airflow/dags/:dag_id`, (req, res, ctx) => {
const { dag_id } = req.params;
const body = JSON.parse(req.body as string);
@@ -82,7 +82,7 @@ export class ApacheAirflowClient implements ApacheAirflowApi {
const response = await Promise.all(
dagIds.map(id => {
return this.fetch<Dag>(`/dags/${id}`).catch(e => {
if (e.message === 'NOT FOUND') {
if (e.message === 'Not Found') {
dagsNotFound.push(id);
} else {
throw e;