Skip to content
This repository has been archived by the owner on Oct 9, 2020. It is now read-only.

Commit

Permalink
Validate base64 payload somewhat
Browse files Browse the repository at this point in the history
  • Loading branch information
crisptrutski committed Feb 20, 2015
1 parent ae0ab74 commit f319818
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"es6-module-loader": "0.14.0",
"mocha": "~2.0.0",
"chai": "^1.10.0",
"react-tools": "^0.12.1"
"react-tools": "^0.12.1",
"atob": "^1.1.2"
},
"repository": {
"type": "git",
Expand Down
6 changes: 5 additions & 1 deletion test/unit-tests.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
var fs = require('fs');
var Builder = require('../index');
var assert = require('chai').assert;
var atob = require('atob');

var err = function(e) {
setTimeout(function() {
Expand Down Expand Up @@ -64,7 +65,10 @@ describe('Source Maps', function() {
var commentPrefix = /^\/\/# sourceMappingURL=data:application\/json;base64,/;
assert(lastLine.match(commentPrefix));
var encoding = lastLine.replace(commentPrefix, "");
// would be nice to decode here and validate that it's a sourcemap
var decoded = JSON.parse(atob(encoding));
// not a regular array so tedious
assert.equal(1, decoded.sources.length);
assert.equal('tree/amd-2.js', decoded.sources[0]);
done();
});
});
Expand Down

0 comments on commit f319818

Please sign in to comment.