deno.land / x / mongoose@6.7.5 / test / helpers / setDottetPath.test.js

setDottetPath.test.js
نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
'use strict';
const assert = require('assert');const setDottedPath = require('../../lib/helpers/path/setDottedPath');
describe('setDottedPath', function() { it('setDottedPath root element', function() { const obj = { clearingInstituteName: 'Our local bank', 'transaction.receipt': 'I am a transaction receipt', 'transaction.authorizationCode': 'ABCDEF', 'transaction.acquirer.settlementDate': 'February 2021', 'sourceOfFunds.provided.card.issuer': 'Big bank corporation', nonExistentField: 'I should not be present' }; setDottedPath(obj, 'authorizationResponse', '123456'); assert.deepEqual(obj, { 'sourceOfFunds.provided.card.issuer': 'Big bank corporation', 'transaction.acquirer.settlementDate': 'February 2021', 'transaction.authorizationCode': 'ABCDEF', 'transaction.receipt': 'I am a transaction receipt', authorizationResponse: '123456', clearingInstituteName: 'Our local bank', nonExistentField: 'I should not be present' }); }); it('setDottedPath sub element', function() { const obj = { clearingInstituteName: 'Our local bank', 'transaction.receipt': 'I am a transaction receipt', 'transaction.authorizationCode': 'ABCDEF', 'transaction.acquirer.settlementDate': 'February 2021', 'sourceOfFunds.provided.card.issuer': 'Big bank corporation', nonExistentField: 'I should not be present' }; setDottedPath(obj, 'authorizationResponse.stan', '123456'); assert.deepEqual(obj, { 'sourceOfFunds.provided.card.issuer': 'Big bank corporation', 'transaction.acquirer.settlementDate': 'February 2021', 'transaction.authorizationCode': 'ABCDEF', 'transaction.receipt': 'I am a transaction receipt', authorizationResponse: { stan: '123456' }, clearingInstituteName: 'Our local bank', nonExistentField: 'I should not be present' }); });});
mongoose

Version Info

Tagged at
a year ago