-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MWPW-142290: Update get/setLibs for stage (#172)
* Updating getLibs to Milo College format, adding testing for libs * More tests, moving around vars * Remove commented out code * CR fixes
- Loading branch information
1 parent
1feafe4
commit 45c418d
Showing
2 changed files
with
72 additions
and
15 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
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,63 @@ | ||
import { expect } from '@esm-bundle/chai'; | ||
import { setLibs } from '../../scripts/utils.js'; | ||
|
||
describe('Libs', () => { | ||
it('Sets default Libs', () => { | ||
const libs = setLibs('/libs'); | ||
expect(libs).to.equal('https://main--milo--adobecom.hlx.live/libs'); | ||
}); | ||
|
||
it('Does not support milolibs query param on prod', () => { | ||
const location = { | ||
hostname: 'business.adobe.com', | ||
search: '?milolibs=foo', | ||
}; | ||
const libs = setLibs('/libs', location); | ||
expect(libs).to.equal('/libs'); | ||
}); | ||
|
||
it('Supports milolibs query param', () => { | ||
const location = { | ||
hostname: 'localhost', | ||
search: '?milolibs=foo', | ||
}; | ||
const libs = setLibs('/libs', location); | ||
expect(libs).to.equal('https://foo--milo--adobecom.hlx.live/libs'); | ||
}); | ||
|
||
it('Supports milo stage libs with stage as host', () => { | ||
const location = { | ||
hostname: 'business.stage.adobe.com', | ||
search: '', | ||
}; | ||
const libs = setLibs('/libs', location); | ||
expect(libs).to.equal('https://www.stage.adobe.com/libs'); | ||
}); | ||
|
||
it('Does not support milo stage libs on non prod stage hosts', () => { | ||
const location = { | ||
hostname: 'stage--bacom--adobecom.hlx.live', | ||
search: '', | ||
}; | ||
const libs = setLibs('/libs', location); | ||
expect(libs).to.equal('https://main--milo--adobecom.hlx.live/libs'); | ||
}); | ||
|
||
it('Supports local milolibs query param', () => { | ||
const location = { | ||
hostname: 'localhost', | ||
search: '?milolibs=local', | ||
}; | ||
const libs = setLibs('/libs', location); | ||
expect(libs).to.equal('http://localhost:6456/libs'); | ||
}); | ||
|
||
it('Supports forked milolibs query param', () => { | ||
const location = { | ||
hostname: 'localhost', | ||
search: '?milolibs=awesome--milo--forkedowner', | ||
}; | ||
const libs = setLibs('/libs', location); | ||
expect(libs).to.equal('https://awesome--milo--forkedowner.hlx.live/libs'); | ||
}); | ||
}); |