-
Notifications
You must be signed in to change notification settings - Fork 185
/
cnameExists.spec.js
38 lines (34 loc) · 1.02 KB
/
cnameExists.spec.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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: 'user@email.com',
},
cname: 'custom-domain.com',
};
ghPages.publish(local, options, (err) => {
if (err) {
return done(err);
}
helper
.assertContentsMatch(expected, url, branch)
.then(() => done())
.catch(done);
});
});
});
});