2022-06-20 14:51:01 -07:00
|
|
|
const helpers = require('../../../nodes/Stripe/helpers');
|
2021-11-03 17:44:25 -07:00
|
|
|
|
|
|
|
describe('adjustMetadata', () => {
|
|
|
|
it('it should adjust multiple metadata values', async () => {
|
|
|
|
const additionalFieldsValues = {
|
|
|
|
metadata: {
|
|
|
|
metadataProperties: [
|
|
|
|
{
|
2022-06-20 14:51:01 -07:00
|
|
|
key: 'keyA',
|
|
|
|
value: 'valueA',
|
2021-11-03 17:44:25 -07:00
|
|
|
},
|
|
|
|
{
|
2022-06-20 14:51:01 -07:00
|
|
|
key: 'keyB',
|
|
|
|
value: 'valueB',
|
2021-11-03 17:44:25 -07:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2022-06-20 14:51:01 -07:00
|
|
|
};
|
2021-11-03 17:44:25 -07:00
|
|
|
|
2022-06-20 14:51:01 -07:00
|
|
|
const adjustedMetadata = helpers.adjustMetadata(additionalFieldsValues);
|
2021-11-03 17:44:25 -07:00
|
|
|
|
|
|
|
const expectedAdjustedMetadata = {
|
|
|
|
metadata: {
|
2022-06-20 14:51:01 -07:00
|
|
|
keyA: 'valueA',
|
|
|
|
keyB: 'valueB',
|
|
|
|
},
|
|
|
|
};
|
|
|
|
expect(adjustedMetadata).toStrictEqual(expectedAdjustedMetadata);
|
2021-11-03 17:44:25 -07:00
|
|
|
});
|
|
|
|
});
|