-
-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: handling xml parsing not returning array for one element (#343)
* fix: fxp not returning array for one element * test: add test for one element returned by fxp * refactor: use asArray for inFile handler xml parsing * test: unit test asArray new method * build: upgrade dependencies
- Loading branch information
Showing
7 changed files
with
379 additions
and
359 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
'use strict' | ||
const { asArray } = require('../../../../src/utils/fxpHelper') | ||
|
||
describe('asArray', () => { | ||
describe('when called with null', () => { | ||
// Arrange | ||
const expected = null | ||
|
||
it('returns empty array', () => { | ||
// Act | ||
const actual = asArray(expected) | ||
|
||
// Assert | ||
expect(actual).toEqual([]) | ||
}) | ||
}) | ||
describe('when called with array', () => { | ||
// Arrange | ||
const expected = [{ test: true }] | ||
|
||
it('returns the same array', () => { | ||
// Act | ||
const actual = asArray(expected) | ||
|
||
// Assert | ||
expect(actual).toBe(expected) | ||
}) | ||
}) | ||
describe('when called with object', () => { | ||
// Arrange | ||
const expected = { test: true } | ||
|
||
it('returns the array with this object', () => { | ||
// Act | ||
const actual = asArray(expected) | ||
|
||
// Assert | ||
expect(actual).toEqual([expected]) | ||
}) | ||
}) | ||
}) |
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
Oops, something went wrong.