-
Notifications
You must be signed in to change notification settings - Fork 125
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
1 parent
eb6ba03
commit 147f3cf
Showing
3 changed files
with
24 additions
and
0 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,11 @@ | ||
/** | ||
* Helper class for instantiating multiple objects with Components.js. | ||
* See https://github.com/LinkedSoftwareDependencies/Components.js/issues/26 | ||
*/ | ||
// eslint-disable-next-line @typescript-eslint/no-extraneous-class | ||
export class RecordObject implements Record<string, any> { | ||
public constructor(record: Record<string, string> = {}) { | ||
// eslint-disable-next-line no-constructor-return | ||
return record; | ||
} | ||
} |
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,12 @@ | ||
import { RecordObject } from '../../../src/util/RecordObject'; | ||
|
||
describe('RecordObject', (): void => { | ||
it('returns an empty record when created without parameters.', async(): Promise<void> => { | ||
expect(new RecordObject()).toStrictEqual({}); | ||
}); | ||
|
||
it('returns the passed record.', async(): Promise<void> => { | ||
const record = { abc: 'def' }; | ||
expect(new RecordObject(record)).toBe(record); | ||
}); | ||
}); |