2017-06-14 13:57:58 -04:00
|
|
|
QUnit.module("lib:discourse");
|
2015-10-21 13:13:19 -04:00
|
|
|
|
2017-06-14 13:57:58 -04:00
|
|
|
QUnit.test("getURL on subfolder install", assert => {
|
2015-10-21 13:13:19 -04:00
|
|
|
Discourse.BaseUri = "/forum";
|
2017-06-14 13:57:58 -04:00
|
|
|
assert.equal(Discourse.getURL("/"), "/forum/", "root url has subfolder");
|
2018-06-15 11:03:24 -04:00
|
|
|
assert.equal(
|
|
|
|
Discourse.getURL("/u/neil"),
|
|
|
|
"/forum/u/neil",
|
|
|
|
"relative url has subfolder"
|
|
|
|
);
|
|
|
|
});
|
2018-08-21 22:31:13 -04:00
|
|
|
|
|
|
|
QUnit.test("getURLWithCDN on subfolder install with S3", assert => {
|
|
|
|
Discourse.BaseUri = "/forum";
|
|
|
|
|
|
|
|
Discourse.S3CDN = "https://awesome.cdn/site";
|
|
|
|
Discourse.S3BaseUrl = "//test.s3-us-west-1.amazonaws.com/site";
|
|
|
|
|
|
|
|
let url = "//test.s3-us-west-1.amazonaws.com/site/forum/awesome.png";
|
|
|
|
let expected = "https://awesome.cdn/site/forum/awesome.png";
|
|
|
|
|
|
|
|
assert.equal(Discourse.getURLWithCDN(url), expected, "at correct path");
|
|
|
|
|
|
|
|
Discourse.S3CDN = null;
|
|
|
|
Discourse.S3BaseUrl = null;
|
|
|
|
});
|