Skip to content

Commit

Permalink
Back out pathDetails.test.js changes
Browse files Browse the repository at this point in the history
  • Loading branch information
bosschaert committed Mar 5, 2024
1 parent eff912d commit faacea5
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 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', () => {
it('HTML path details', () => {
describe('HTML path details', () => {
const loc = { pathname: '/edit', hash: '#/adobe/aem-boilerplate/cool/page' };
const details = getPathDetails(loc);
expect(details.origin).to.equal('https://admin.da.live');
expect(details.origin).to.equal('http://localhost:8787');
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('https://admin.da.live/source/adobe/aem-boilerplate/cool/page.html');
expect(details.sourceUrl).to.equal('http://localhost:8787/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');
});

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

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

it('Top level path details', () => {
describe('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,35 +40,33 @@ describe('Path details', () => {
});

describe('Repo only path details', () => {
it('Path details', () => {
describe('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', () => {
it('Path details', () => {
describe('Path details', () => {
const loc = { hash: '#/adobe' };
const details = getPathDetails(loc);
expect(details.previewUrl).to.not.exist;
});
});

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

/*
describe('IMS callback path details', () => {
it('Path details', () => {
describe('Path details', () => {
const details = getPathDetails();
expect(details).to.be.null;
});
});
*/
});

0 comments on commit faacea5

Please sign in to comment.