Last active
September 28, 2017 08:03
-
-
Save BrianJVarley/8738b0cfb75ab6910d2ebaa97ffa9052 to your computer and use it in GitHub Desktop.
Test spec for encrypt web service call with Mocha and Chai
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@ssube refactor to async pattern when calling axios request. appreciate advice.