-
Notifications
You must be signed in to change notification settings - Fork 191
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test for cnameExists, asserting it replaces the existing CNAME
- Loading branch information
1 parent
1c60556
commit b6b8454
Showing
6 changed files
with
42 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,38 @@ | ||
const helper = require('../helper.js'); | ||
const ghPages = require('../../lib/index.js'); | ||
const path = require('path'); | ||
|
||
const fixtures = path.join(__dirname, 'fixtures'); | ||
const fixtureName = 'cname-exists'; | ||
|
||
beforeEach(() => { | ||
ghPages.clean(); | ||
}); | ||
|
||
describe('the --cname option', () => { | ||
it('works even if the CNAME file already exists AND replaces any existing value', (done) => { | ||
const local = path.join(fixtures, fixtureName, 'local'); | ||
const expected = path.join(fixtures, fixtureName, 'expected'); | ||
const branch = 'gh-pages'; | ||
|
||
helper.setupRemote(fixtureName, {branch}).then((url) => { | ||
const options = { | ||
repo: url, | ||
user: { | ||
name: 'User Name', | ||
email: '[email protected]', | ||
}, | ||
cname: 'custom-domain.com', | ||
}; | ||
ghPages.publish(local, options, (err) => { | ||
if (err) { | ||
return done(err); | ||
} | ||
helper | ||
.assertContentsMatch(expected, url, branch) | ||
.then(() => done()) | ||
.catch(done); | ||
}); | ||
}); | ||
}); | ||
}); |
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 @@ | ||
custom-domain.com |
1 change: 1 addition & 0 deletions
1
test/integration/fixtures/cname-exists/expected/hello-world.txt
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 @@ | ||
Hello World! |
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 @@ | ||
Hello World! |
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 @@ | ||
existing-domain.com |
Empty file.