diff --git a/test.js b/test.js index 9947a80..7052ce0 100644 --- a/test.js +++ b/test.js @@ -48,6 +48,12 @@ describe('Faux-Knox', function(){ done(); }); }); + it('should get a file that has a uri encoding', function(done){ + client.getFile(encodeURIComponent('path/to encoded/json file.json'), null, function(err, cres){ + cres.should.have.property('statusCode', 200); + done(); + }); + }); }); describe('putFile', function(){ it('should put a file into bucket', function(done){ @@ -67,6 +73,15 @@ describe('Faux-Knox', function(){ done(); }); }); + it('should put a file into encoded path', function(done){ + client.putFile('./test_files/put/fort_knox_tank.jpg', encodeURIComponent('from/a fort knox path/super tank.jpg'), function(err, res){ + res.should.have.property('statusCode', 201); + fs.exists('./test_files/from/a fort knox path/super tank.jpg', function(existy){ + existy.should.be.true; + done(); + }); + }); + }); }); describe('putBuffer', function(){ it('should put a buffer where I tell it to', function(done){ diff --git a/test_files/path/to encoded/json file.json b/test_files/path/to encoded/json file.json new file mode 100644 index 0000000..0071332 --- /dev/null +++ b/test_files/path/to encoded/json file.json @@ -0,0 +1,34 @@ +{ + "name": "faux-knox", + "version": "0.1.5", + "description": "Mock requests to knox module using file system", + "main": "index.js", + "scripts": { + "test": "./node_modules/.bin/mocha" + }, + "repository": { + "type": "git", + "url": "git://github.com/wlaurance/faux-knox.git" + }, + "keywords": [ + "knox", + "mock" + ], + "author": "Will S. Laurance", + "license": "BSD", + "readmeFilename": "README.md", + "gitHead": "cf1d54e5cf8ae5e6a6e2142ab42f7eb4a068147a", + "bugs": { + "url": "https://github.com/wlaurance/faux-knox/issues" + }, + "devDependencies": { + "mocha": "~1.12.0", + "should": "~1.2.2" + }, + "dependencies": { + "underscore": "~1.5.1", + "async": "~0.2.9", + "mkdirp": "~0.3.5", + "rimraf": "~2.2.1" + } +}