/* global describe, it */

const should = require('should')
const cb = require('../index')
const fs = require('fs')

describe('A valid proof converted to binary and back ', function () {
  describe('Using test1.json', function () {
    it('should return proof equal to original JSON', function (done) {
      fs.readFile('./test/json/test1.json', 'utf-8', function (err, jsonSample) {
        should.not.exist(err)
        should.exist(jsonSample)
        cb.objectToBinary(jsonSample, function (err, proofBinary) {
          should.not.exist(err)
          should.exist(proofBinary)
          cb.binaryToObject(proofBinary, function (err, proofObject) {
            should.not.exist(err)
            should.exist(proofObject)
            jsonSample = jsonSample.replace(/(\r\n|\n|\r| )/gm, '') // remove any whitespace/cf/lf
            let resultJSON = JSON.stringify(proofObject)
            resultJSON.should.equal(jsonSample)
            done()
          })
        })
      })
    })
  })
})

/* global describe, it */

const should = require('should')
const cb = require('../index')
const fs = require('fs')

describe('Testing valid format receipts should convert to CHP and back to same source JSON ', function () {
  describe('Using test1.json - ', function () {
    it('JSON >> CHP >> JSON should return result equal to origin JSON', function (done) {
      fs.readFile('./test/json/test1.json', 'utf-8', function (err, sourceFileJSON) {
        should.not.exist(err)
        should.exist(sourceFileJSON)
        cb.objectToBinary(sourceFileJSON, function (err, chpData) {
          should.not.exist(err)
          should.exist(chpData)
          cb.binaryToObject(chpData, function (err, resultObject) {
            should.not.exist(err)
            should.exist(resultObject)
            sourceFileJSON = sourceFileJSON.replace(/(\r\n|\n|\r| )/gm, '') // remove any whitespace/cf/lf
            let resultJSON = JSON.stringify(resultObject)
            resultJSON.should.equal(sourceFileJSON)
            done()
          })
        })
      })
    })
  })
})

--- 
+++ 
@@ -4,21 +4,21 @@
 const cb = require('../index')
 const fs = require('fs')
 
-describe('A valid proof converted to binary and back ', function () {
-  describe('Using test1.json', function () {
-    it('should return proof equal to original JSON', function (done) {
-      fs.readFile('./test/json/test1.json', 'utf-8', function (err, jsonSample) {
+describe('Testing valid format receipts should convert to CHP and back to same source JSON ', function () {
+  describe('Using test1.json - ', function () {
+    it('JSON >> CHP >> JSON should return result equal to origin JSON', function (done) {
+      fs.readFile('./test/json/test1.json', 'utf-8', function (err, sourceFileJSON) {
         should.not.exist(err)
-        should.exist(jsonSample)
-        cb.objectToBinary(jsonSample, function (err, proofBinary) {
+        should.exist(sourceFileJSON)
+        cb.objectToBinary(sourceFileJSON, function (err, chpData) {
           should.not.exist(err)
-          should.exist(proofBinary)
-          cb.binaryToObject(proofBinary, function (err, proofObject) {
+          should.exist(chpData)
+          cb.binaryToObject(chpData, function (err, resultObject) {
             should.not.exist(err)
-            should.exist(proofObject)
-            jsonSample = jsonSample.replace(/(\r\n|\n|\r| )/gm, '') // remove any whitespace/cf/lf
-            let resultJSON = JSON.stringify(proofObject)
-            resultJSON.should.equal(jsonSample)
+            should.exist(resultObject)
+            sourceFileJSON = sourceFileJSON.replace(/(\r\n|\n|\r| )/gm, '') // remove any whitespace/cf/lf
+            let resultJSON = JSON.stringify(resultObject)
+            resultJSON.should.equal(sourceFileJSON)
             done()
           })
         })
Use consistent terminology in tests as in the README
