Skip to content

Commit

Permalink
chore(up): pr feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
rofe committed Sep 2, 2024
1 parent 3eaf846 commit df198b5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
5 changes: 2 additions & 3 deletions src/up.cmd.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,9 @@ export default class UpCommand extends AbstractServerCommand {
if (!this._url) {
await this.verifyUrl(this._gitUrl, ref);
} else if (/\{\{(owner|repo)+\}\}/.test(this._url)) {
const { owner, repo } = await GitUtils.getOriginURL(this.directory);
this._url = this._url
.replace(/\{\{owner\}\}/, owner)
.replace(/\{\{repo\}\}/, repo);
.replace(/\{\{owner\}\}/, this._gitUrl.owner)
.replace(/\{\{repo\}\}/, this._gitUrl.repo);
}
this._project.withProxyUrl(this._url);
await this.initServerOptions();
Expand Down
6 changes: 3 additions & 3 deletions test/up-cmd.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,9 @@ describe('Integration test for up command with helix pages', function suite() {
.withDirectory(testDir)
.withOpen(false)
.withHttpPort(0)
.withUrl('https://main--{{repo}}--{{owner}}.hlx.page');
.withUrl('https://main--{{repo}}--{{owner}}.example.com');

nock('https://main--dummy-foo--adobe.hlx.page')
nock('https://main--dummy-foo--adobe.example.com')
.get('/index.html')
.reply(200, '## Welcome');

Expand All @@ -180,7 +180,7 @@ describe('Integration test for up command with helix pages', function suite() {
.on('started', async () => {
try {
// eslint-disable-next-line no-underscore-dangle
assert.equal(cmd._url, 'https://main--dummy-foo--adobe.hlx.page');
assert.equal(cmd._url, 'https://main--dummy-foo--adobe.example.com');
port = cmd.project.server.port;
const ret = await assertHttp(`http://127.0.0.1:${port}/index.html`, 200);
assert.strictEqual(ret.trim(), '## Welcome');
Expand Down

0 comments on commit df198b5

Please sign in to comment.