Skip to content

Commit

Permalink
[#799] Re-adding uuid test case due to fix conflict in TypeAutoField
Browse files Browse the repository at this point in the history
  • Loading branch information
ifirmawan committed Jan 8, 2024
1 parent 2cba8de commit 93a064e
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions app/src/form/fields/__test__/TypeAutofield.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,28 @@ describe('TypeAutofield component', () => {
expect(autoField.props.value).toBe('G0');
});

test('it supports to generate UUID', () => {
const onChangeMock = jest.fn();
const values = {
517600060: [9.123673412317656, 40.50754409565747],
608880002: 'Village name',
};
const id = 3;
const name = 'Auto Field';
const fn = {
fnString:
"function(){ return #517600060 && #608880002 ? #608880002.replace(' ','-').replace(',','-') + '-' + #517600060.replace('-','').replace(',','.').split('.').reduce((x, y) => parseInt(x) + parseInt(y), 0).toString(32).substring(3,7) : null}",
};

const { getByTestId } = render(
<TypeAutofield onChange={onChangeMock} values={values} id={id} name={name} fn={fn} />,
);

const autoField = getByTestId('type-autofield');
expect(autoField).toBeDefined();
expect(autoField.props.value).toBe('Village-name-gi5p');
});

test('it gives background color when fnColor is defined and cover all possible outputs', () => {
const onChangeMock = jest.fn();
const values = {
Expand Down

0 comments on commit 93a064e

Please sign in to comment.