Skip to content

Commit b6b8454

Browse files
committed
Add test for cnameExists, asserting it replaces the existing CNAME
1 parent 1c60556 commit b6b8454

6 files changed

Lines changed: 42 additions & 0 deletions

File tree

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
const helper = require('../helper.js');
2+
const ghPages = require('../../lib/index.js');
3+
const path = require('path');
4+
5+
const fixtures = path.join(__dirname, 'fixtures');
6+
const fixtureName = 'cname-exists';
7+
8+
beforeEach(() => {
9+
ghPages.clean();
10+
});
11+
12+
describe('the --cname option', () => {
13+
it('works even if the CNAME file already exists AND replaces any existing value', (done) => {
14+
const local = path.join(fixtures, fixtureName, 'local');
15+
const expected = path.join(fixtures, fixtureName, 'expected');
16+
const branch = 'gh-pages';
17+
18+
helper.setupRemote(fixtureName, {branch}).then((url) => {
19+
const options = {
20+
repo: url,
21+
user: {
22+
name: 'User Name',
23+
email: 'user@email.com',
24+
},
25+
cname: 'custom-domain.com',
26+
};
27+
ghPages.publish(local, options, (err) => {
28+
if (err) {
29+
return done(err);
30+
}
31+
helper
32+
.assertContentsMatch(expected, url, branch)
33+
.then(() => done())
34+
.catch(done);
35+
});
36+
});
37+
});
38+
});
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
custom-domain.com
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Hello World!
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Hello World!
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
existing-domain.com

test/integration/fixtures/cname-exists/remote/initial

Whitespace-only changes.

0 commit comments

Comments
 (0)