mirror of
https://github.com/zhigang1992/reactfire.git
synced 2026-04-01 22:42:36 +08:00
Changing how generateRandomString() is implemented to reduce number of failed tests
Tests were failing due to generateRandomString() sometimes returning a string with a “.” in it (which is invalid in Firebase”).
This commit is contained in:
@@ -94,4 +94,4 @@ $ gulp watch # watch for source file changes
|
||||
|
||||
`gulp watch` will watch for changes in the `/src/` directory and lint, concatenate, and minify the source files when a change occurs. The output files - `reactfire.js` and `reactfire.min.js` - are written to the `/dist/` directory.
|
||||
|
||||
You can run the test suite by navigating to `file:///path/to/tests/TestRunner.html` or run the tests via the command line using `gulp test`.
|
||||
You can run the test suite by navigating to `file:///path/to/reactfire/tests/TestRunner.html` or via the command line using `gulp test`.
|
||||
@@ -39,7 +39,15 @@ function afterEachHelper(done) {
|
||||
|
||||
/* Returns a random alphabetic string of variable length */
|
||||
function generateRandomString() {
|
||||
return (Math.random() + 1).toString(36).substring(7);
|
||||
var possibleCharacters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
||||
var numPossibleCharacters = possibleCharacters.length;
|
||||
|
||||
var text = "";
|
||||
for (var i = 0; i < 10; i++) {
|
||||
text += possibleCharacters.charAt(Math.floor(Math.random() * numPossibleCharacters));
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
/* Returns the current data in the Firebase */
|
||||
|
||||
Reference in New Issue
Block a user