-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
32 lines (28 loc) · 841 Bytes
/
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
const redoJson = require('./index.js');
var chai = require('chai'),
expect = chai.expect;
const input = '{message: Transaction, reference: null, status: false, method: card, verify: false, card: {expiryMonth: 1, expiryYear: 01, _type: VERVE, _last4Digits: 7812, _number: null}}';
const expectedJSON = {
message: 'Transaction',
reference: null,
status: false,
method: 'card',
verify: false,
card: {
expiryMonth: 1,
expiryYear: '01',
_type: 'VERVE',
_last4Digits: 7812,
_number: null,
},
};
describe('json fix test', function () {
it('should return return an object', function () {
const parsed = redoJson.parse(input);
expect(parsed).to.be.an('object');
});
it("should be equal to 'expected' object", function () {
const parsed = redoJson.parse(input);
expect(parsed).to.be.deep.equal(expectedJSON);
});
});