This repository has been archived by the owner on Jul 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* test: Add failing test Should return an empty array, but helper returns a string * fix: Return an empty array, rather than a string If no IDs are provided to the buildRelationshipData() function, return an empty array Fixes #108
- Loading branch information
Showing
3 changed files
with
21 additions
and
2 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
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,19 @@ | ||
import { expect } from 'chai'; | ||
import { buildRelationshipData } from '../../src/utils/helpers'; | ||
|
||
describe('Build relationship payloads', () => { | ||
it('should return an array of relationship key value pairings', () => { | ||
const relationships = buildRelationshipData('category', ['123', '456']); | ||
|
||
expect(relationships).to.deep.include.members([ | ||
{ type: 'category', id: '123' }, | ||
{ type: 'category', id: '456' }, | ||
]); | ||
}); | ||
|
||
it('should return an empty array', () => { | ||
const relationships = buildRelationshipData('category', null); | ||
|
||
expect(relationships).to.be.an('array').that.is.empty; | ||
}); | ||
}); |