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

Commit ba7a168

Browse files
authored
Update 1.0 methods with getFieldValues for multi-select fields [NS-1795] (#22)
* add links sublist to nlobjRecord object * add getFieldValues for multi-select fields * fix missing , * unit tests for getFieldValues * install dependencies
1 parent 9a009dd commit ba7a168

File tree

3 files changed

+1326
-1310
lines changed

3 files changed

+1326
-1310
lines changed

Tests/Utils/record.test.js

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,23 @@
33
*
44
*/
55

6-
const fileUnderTest = require('../../Utils/record');
6+
const FileUnderTest = require('../../Utils/record');
77

8-
describe('Testing record', () => {
9-
it('Should return a function ', () => {
10-
expect(fileUnderTest).toEqual(expect.any(Function));
8+
describe('testing record', () => {
9+
it('should return a function ', () => {
10+
expect(FileUnderTest).toEqual(expect.any(Function));
11+
});
12+
});
13+
14+
describe('setFieldValues', () => {
15+
it('should check whether method exists', () => {
16+
const result = new FileUnderTest('');
17+
expect(Object.prototype.hasOwnProperty.call(result, 'setFieldValues')).toBeTruthy();
18+
});
19+
it('should assign values to fieldName', () => {
20+
const result = new FileUnderTest();
21+
const values = ['123456', '654321'];
22+
result.setFieldValues('selectField', values);
23+
expect(result.getFieldValue('selectField')).toEqual(['123456', '654321']);
1124
});
1225
});

Utils/record.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,9 @@ function NsRecord(name, defaultValues = {}) {
114114
setFieldValue: (valueName, value) => {
115115
this.values[valueName] = value;
116116
},
117+
setFieldValues: (fieldName, values) => {
118+
this.values[fieldName] = values
119+
},
117120
setLineItemValue: (sublist, field, index, value) => {
118121
this.values[sublist][index - 1][field] = value;
119122
},

0 commit comments

Comments
 (0)