Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-74 - Collaborative awareness #71

Merged
merged 12 commits into from
Mar 6, 2024
26 changes: 14 additions & 12 deletions test/blocks/shared/pathDetails.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,32 @@ const { default: getPathDetails } = await import('../../../blocks/shared/pathDet

describe('Path details', () => {
describe('Full path details', () => {
describe('HTML path details', () => {
it('HTML path details', () => {
const loc = { pathname: '/edit', hash: '#/adobe/aem-boilerplate/cool/page' };
const details = getPathDetails(loc);
expect(details.origin).to.equal('http://localhost:8787');
expect(details.origin).to.equal('https://admin.da.live');
expect(details.owner).to.equal('adobe');
expect(details.repo).to.equal('aem-boilerplate');
expect(details.fullpath).to.equal('/adobe/aem-boilerplate/cool/page');
expect(details.sourceUrl).to.equal('http://localhost:8787/source/adobe/aem-boilerplate/cool/page.html');
expect(details.sourceUrl).to.equal('https://admin.da.live/source/adobe/aem-boilerplate/cool/page.html');
expect(details.contentUrl).to.equal('https://content.da.live/adobe/aem-boilerplate/cool/page');
expect(details.previewUrl).to.equal('https://main--aem-boilerplate--adobe.hlx.page/cool/page');
});

describe('JSON path details', () => {
it('JSON path details', () => {
const loc = { pathname: '/sheet', hash: '#/adobe/aem-boilerplate/cool/data' };
const details = getPathDetails(loc);
expect(details.sourceUrl).to.equal('http://localhost:8787/source/adobe/aem-boilerplate/cool/data.json');
expect(details.sourceUrl).to.equal('https://admin.da.live/source/adobe/aem-boilerplate/cool/data.json');
expect(details.contentUrl).to.equal('https://content.da.live/adobe/aem-boilerplate/cool/data.json');
});

describe('JPG path details', () => {
it('JPG path details', () => {
const loc = { pathname: '/view', hash: '#/adobe/aem-boilerplate/cool/pic.jpg' };
const details = getPathDetails(loc);
expect(details.sourceUrl).to.equal('http://localhost:8787/source/adobe/aem-boilerplate/cool/pic.jpg');
expect(details.sourceUrl).to.equal('https://admin.da.live/source/adobe/aem-boilerplate/cool/pic.jpg');
});

describe('Top level path details', () => {
it('Top level path details', () => {
const loc = { pathname: '/view', hash: '#/adobe/aem-boilerplate/pic.jpg' };
const details = getPathDetails(loc);
expect(details.parentName).to.equal('aem-boilerplate');
Expand All @@ -40,33 +40,35 @@ describe('Path details', () => {
});

describe('Repo only path details', () => {
describe('Path details', () => {
it('Path details', () => {
const loc = { hash: '#/adobe/aem-boilerplate' };
const details = getPathDetails(loc);
expect(details.previewUrl).to.equal('https://main--aem-boilerplate--adobe.hlx.page');
});
});

describe('Owner only path details', () => {
describe('Path details', () => {
it('Path details', () => {
const loc = { hash: '#/adobe' };
const details = getPathDetails(loc);
expect(details.previewUrl).to.not.exist;
});
});

describe('IMS callback path details', () => {
describe('Path details', () => {
it('Path details', () => {
const loc = { hash: '#old_hash' };
const details = getPathDetails(loc);
expect(details).to.be.null;
});
});

/*
bosschaert marked this conversation as resolved.
Show resolved Hide resolved
describe('IMS callback path details', () => {
describe('Path details', () => {
it('Path details', () => {
const details = getPathDetails();
expect(details).to.be.null;
});
});
*/
});
4 changes: 2 additions & 2 deletions web-test-runner.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default {
'**/deps/**',
],
},
plugins: [importMapsPlugin({})],
plugins: [importMapsPlugin({ inject: { importMap: { imports: { 'da-y-wrapper': '/deps/da-y-wrapper/dist/index.js' } } } })],
reporters: [
defaultReporter({ reportTestResults: true, reportTestProgress: true }),
customReporter(),
Expand All @@ -44,7 +44,7 @@ export default {
}
return oldFetch.call(window, resource, options);
};

const oldXHROpen = XMLHttpRequest.prototype.open;
XMLHttpRequest.prototype.open = async function (...args) {
let [method, url, asyn] = args;
Expand Down