-
Notifications
You must be signed in to change notification settings - Fork 185
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
66f3ddb
commit 878fe5c
Showing
7 changed files
with
73 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
// to be copied |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This file should not be removed. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
// to be copied |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/* to be removed */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
// to be removed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This file should not be removed. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
const helper = require('../helper'); | ||
const ghPages = require('../../lib/'); | ||
const path = require('path'); | ||
|
||
const fixtures = path.join(__dirname, 'fixtures'); | ||
const fixtureName = 'remove'; | ||
|
||
beforeEach(() => { | ||
ghPages.clean(); | ||
}); | ||
|
||
describe('the remove option', () => { | ||
it('removes matched files in remote branch', done => { | ||
const local = path.join(fixtures, fixtureName, 'local'); | ||
const expected = path.join(fixtures, fixtureName, 'expected'); | ||
const branch = 'gh-pages'; | ||
const remove = '*.{js,css}'; | ||
|
||
helper.setupRemote(fixtureName, {branch}).then(url => { | ||
const options = { | ||
repo: url, | ||
user: { | ||
name: 'User Name', | ||
email: 'user@email.com' | ||
}, | ||
remove: remove | ||
}; | ||
|
||
ghPages.publish(local, options, err => { | ||
if (err) { | ||
return done(err); | ||
} | ||
helper | ||
.assertContentsMatch(expected, url, branch) | ||
.then(() => done()) | ||
.catch(done); | ||
}); | ||
}); | ||
}); | ||
|
||
it('skips removing files if there are no files to be removed', done => { | ||
const local = path.join(fixtures, fixtureName, 'remote'); | ||
const branch = 'gh-pages'; | ||
const remove = 'non-exist-file'; | ||
|
||
helper.setupRemote(fixtureName, {branch}).then(url => { | ||
const options = { | ||
repo: url, | ||
user: { | ||
name: 'User Name', | ||
email: 'user@email.com' | ||
}, | ||
remove: remove | ||
}; | ||
|
||
ghPages.publish(local, options, err => { | ||
if (err) { | ||
return done(err); | ||
} | ||
helper | ||
.assertContentsMatch(local, url, branch) | ||
.then(() => done()) | ||
.catch(done); | ||
}); | ||
}); | ||
}); | ||
}); |