git-origin-check
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -24,2 +24,4 @@ const gitRemoteOriginUrl = require('git-remote-origin-url'); | ||
} | ||
return true; | ||
}; |
{ | ||
"name": "git-origin-check", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Validates Git origin is set to correct host.", | ||
@@ -5,0 +5,0 @@ "bin": { |
@@ -8,6 +8,8 @@ # git-origin-check | ||
Validates Git origin is set to correct host. When used in combination with Husky as a `pre-push` hook it enables users to ensure code is not inadvertently pushed to the wrong Github instance. | ||
Validates Git origin is set to the correct host. When used in combination with Husky as a `pre-push` hook it enables users to ensure code is not inadvertently pushed to the wrong Github instance. This will check static origin URLs as well as SSH aliases for the correct URL. | ||
Example Usage: | ||
## Example Usage: | ||
### 1. Install Module | ||
``` | ||
@@ -17,1 +19,10 @@ npm install git-origin-check | ||
``` | ||
### 2. Add Husky Hook | ||
``` | ||
"husky": { | ||
"hooks": { | ||
"pre-push": "git-origin-check github.com" | ||
} | ||
} | ||
``` |
@@ -1,8 +0,19 @@ | ||
var assert = require('chai').assert; | ||
const originCheck = require('../lib/originCheck.js'); | ||
const assert = require('chai').assert; | ||
describe('git-origin-check', () => { | ||
it('should write some tests', (done) => { | ||
// TODO! | ||
done(); | ||
describe('git-origin-check', async () => { | ||
it('should pass with default repo of github.com', async () => { | ||
assert(await originCheck.check('github.com'), 'github.com pass'); | ||
}); | ||
it('should fail with default repo of github.com when checking github.co', async () => { | ||
try{ | ||
await originCheck.check('github.co'); | ||
assert(false, 'github.co shouldnt pass'); | ||
} catch(e){ | ||
assert(true, 'github.co should fail'); | ||
} | ||
}); | ||
// TODO: test cases for ssh aliases | ||
}); |
4619
53
26