You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ma...@apache.org on 2023/08/08 14:18:40 UTC

[camel-karavan] branch main updated: fix windows test compatibility #843 (#846)

This is an automated email from the ASF dual-hosted git repository.

marat pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-karavan.git


The following commit(s) were added to refs/heads/main by this push:
     new d2616094 fix windows test compatibility #843 (#846)
d2616094 is described below

commit d2616094a580aa43c98165a04ea5fed21956e0fa
Author: Stefan Huber <ma...@stefanhuber.at>
AuthorDate: Tue Aug 8 16:18:34 2023 +0200

    fix windows test compatibility #843 (#846)
    
    Co-authored-by: Stefan Huber <st...@hoffmann-group.com>
---
 karavan-core/test/errorHandler.spec.ts | 3 ++-
 karavan-core/test/findStep.spec.ts     | 2 +-
 karavan-core/test/plain.spec.ts        | 2 +-
 karavan-core/test/routes.spec.ts       | 4 ++--
 4 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/karavan-core/test/errorHandler.spec.ts b/karavan-core/test/errorHandler.spec.ts
index ee605f86..c2da1c2f 100644
--- a/karavan-core/test/errorHandler.spec.ts
+++ b/karavan-core/test/errorHandler.spec.ts
@@ -16,6 +16,7 @@
  */
 import {expect} from 'chai';
 import * as fs from 'fs';
+import * as jsYaml from 'js-yaml';
 import 'mocha';
 import {CamelDefinitionYaml} from "../src/core/api/CamelDefinitionYaml";
 
@@ -32,6 +33,6 @@ describe('Global Error Handler', () => {
         expect(i.spec.flows?.[1].errorHandler.deadLetterChannel.useOriginalMessage).to.equal(true);
         expect(i.spec.flows?.[1].errorHandler.deadLetterChannel.level).to.equal('TRACE');
         const yaml2 = CamelDefinitionYaml.integrationToYaml(i);
-        expect(yaml).to.equal(yaml2);
+        expect(yaml.replaceAll("\r\n", "\n")).to.equal(yaml2); // replace for Windows compatibility
     });
 });
diff --git a/karavan-core/test/findStep.spec.ts b/karavan-core/test/findStep.spec.ts
index b1a98fc0..fada15e3 100644
--- a/karavan-core/test/findStep.spec.ts
+++ b/karavan-core/test/findStep.spec.ts
@@ -101,7 +101,7 @@ describe('Find Step', () => {
         const yaml = fs.readFileSync('test/findStep.yaml',{encoding:'utf8', flag:'r'});
         const i = CamelDefinitionYaml.yamlToIntegration("demo.yaml", yaml);
         const yaml2 = CamelDefinitionYaml.integrationToYaml(i);
-        expect(yaml2).to.equal(yaml);
+        expect(yaml.replaceAll("\r\n", "\n")).to.equal(yaml2); // replace for Windows compatibility
 
         const res1 = CamelDefinitionApiExt.hasElementWithId(i, 'to-6a8b');
         const res2 = CamelDefinitionApiExt.hasElementWithId(i, 'to-6a81');
diff --git a/karavan-core/test/plain.spec.ts b/karavan-core/test/plain.spec.ts
index 7d6fcca5..627a6a77 100644
--- a/karavan-core/test/plain.spec.ts
+++ b/karavan-core/test/plain.spec.ts
@@ -59,7 +59,7 @@ describe('Plain YAML to integration', () => {
         expect(i.spec.flows?.length).to.equal(1);
         expect(i.type).to.equal('plain');
         const yaml2 = CamelDefinitionYaml.integrationToYaml(i);
-        expect(yaml).to.equal(yaml2);
+        expect(yaml.replaceAll("\r\n", "\n")).to.equal(yaml2); // replace for Windows compatibility
     });
 
 });
diff --git a/karavan-core/test/routes.spec.ts b/karavan-core/test/routes.spec.ts
index a8b3be02..a1fb9a9a 100644
--- a/karavan-core/test/routes.spec.ts
+++ b/karavan-core/test/routes.spec.ts
@@ -31,8 +31,8 @@ describe('Plain YAML with route to integration', () => {
         expect(i.type).to.equal('plain');
         if (i.spec.flows) expect(i.spec.flows[0].from.uri).to.equal('timer');
         if (i.spec.flows) expect(i.spec.flows[0].from.parameters.name).to.equal('info');
-        const y = CamelDefinitionYaml.integrationToYaml(i);
-        expect(y).to.equal(yaml);
+        const yaml2 = CamelDefinitionYaml.integrationToYaml(i);
+        expect(yaml.replaceAll("\r\n", "\n")).to.equal(yaml2); // replace for Windows compatibility
     });
 
 });