From fbbffe03a5bb42b9b384773fd548d706f5b949b9 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 6 Oct 2016 09:57:25 -0700 Subject: [PATCH] Add getPath specs --- spec/api-app-spec.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/spec/api-app-spec.js b/spec/api-app-spec.js index 84c207713e7b..6cc6f777739a 100644 --- a/spec/api-app-spec.js +++ b/spec/api-app-spec.js @@ -334,4 +334,23 @@ describe('app module', function () { assert.equal(typeof app.isAccessibilitySupportEnabled(), 'boolean') }) }) + + describe('getPath(name)', function () { + it('returns paths that exist', function () { + assert.equal(fs.existsSync(app.getPath('exe')), true) + assert.equal(fs.existsSync(app.getPath('home')), true) + assert.equal(fs.existsSync(app.getPath('temp')), true) + }) + + it('throws an error when the name is invalid', function () { + assert.throws(function () { + app.getPath('does-not-exist') + }, /Failed to get 'does-not-exist' path/) + }) + + it('returns the overridden path', function () { + app.setPath('music', __dirname) + assert.equal(app.getPath('music'), __dirname) + }) + }) })