-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
74 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/ui/src/models/camel/__snapshots__/camel-resource.test.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
packages/ui/src/serializers/yaml-camel-resource-serializer.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { YamlCamelResourceSerializer } from './yaml-camel-resource-serializer'; | ||
import { camelRouteJson, camelRouteYaml } from '../stubs'; | ||
import { CamelRouteResource } from '../models/camel'; | ||
|
||
describe('YamlCamelResourceSerializer', () => { | ||
let serializer: YamlCamelResourceSerializer; | ||
|
||
beforeEach(() => { | ||
serializer = new YamlCamelResourceSerializer(); | ||
}); | ||
|
||
it('parses YAML code into JSON object', () => { | ||
const result = serializer.parse(camelRouteYaml); | ||
expect(result).toEqual([camelRouteJson]); | ||
}); | ||
|
||
it('returns empty array for empty or non-string input in parse', () => { | ||
expect(serializer.parse('')).toEqual([]); | ||
expect(serializer.parse(null as unknown as string)).toEqual([]); | ||
expect(serializer.parse(123 as unknown as string)).toEqual([]); | ||
}); | ||
|
||
it('includes comments in serialized YAML string', () => { | ||
const entities = serializer.parse('# comment1\n' + camelRouteYaml); | ||
console.log(serializer.comments); | ||
expect(serializer.comments.includes('# comment1')).toBeTruthy(); | ||
|
||
serializer.comments.push('# Comment2'); | ||
const result = serializer.serialize(new CamelRouteResource(entities)); | ||
expect(result).toContain('# Comment2'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters