Skip to content

Instantly share code, notes, and snippets.

@BrianJVarley
Last active September 28, 2017 08:03
Show Gist options
  • Save BrianJVarley/8738b0cfb75ab6910d2ebaa97ffa9052 to your computer and use it in GitHub Desktop.
Save BrianJVarley/8738b0cfb75ab6910d2ebaa97ffa9052 to your computer and use it in GitHub Desktop.
Test spec for encrypt web service call with Mocha and Chai
import * as constDefs from '../../utility/constDefinitions'
import React, {
Component
} from 'react';
import chai from 'chai';
import axios from 'axios';
var assert = chai.assert;
var passwordsToTest = ["password", "password123", "testPassword!23"];
passwordsToTest.forEach(function(password) {
it('Should return the exchange rates for btc_ltc', (done) => {
// note the return
axios.post(constDefs.BASE_URL_MODULE_SERVICE + 'Encrypt', {
withCredentials: true
},
JSON.stringify({
Password: password
})
).then(function(data){
assert.notEqual(data.Password, password);
}).then(done, done)
});
});
@BrianJVarley
Copy link
Author

@ssube refactor to async pattern when calling axios request. appreciate advice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment