Skip to content
This repository was archived by the owner on Apr 10, 2024. It is now read-only.

Feat: Add getRecordType method to NsRecord [NS-1969] #24

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Tests/Utils/record.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,11 @@ describe('getFieldValues', () => {
expect(myValues).toEqual(['123', '123']);
});
});

describe('getRecordType', () => {
it('should return record type', () => {
const result = new FileUnderTest();
const recordType = result.getRecordType();
expect(recordType).toEqual('nlobjRecord');
});
});
1 change: 1 addition & 0 deletions Utils/record.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ function NsRecord(name, defaultValues = {}) {
getLineItemCount: sublist => this.values[sublist].length,
getLineItemText: (sublist, field, index) => this.values[sublist][index - 1][`${field}_display`],
getLineItemValue: (sublist, field, index) => this.values[sublist][index - 1][field],
getRecordType: () => this.type,
getSublistText: options => this.values[options.sublistId][options.line][options.fieldId],
getSublistValue: options => this.values[options.sublistId][options.line][options.fieldId],
getSublists: sublistObj,
Expand Down