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

[OC-120] Registry webUI: preview route/view bug #597

Merged
merged 13 commits into from
Aug 12, 2017
Merged

Conversation

nickbalestra
Copy link
Contributor

Preview route didnt take into account of registry prefix for paths

@nickbalestra nickbalestra changed the title Preview route/view bug Registry webUI: preview route/view bug Aug 5, 2017
@matteofigus
Copy link
Member

The baseUrl should be set to contain the prefix too. Perhaps we should improve the baseUrl docs?

@nickbalestra
Copy link
Contributor Author

Mmmm I see...
Yes totally not clear.
My personal feeling is that if you use two seperate configuration then the two things should be indipendent, no?

@nickbalestra
Copy link
Contributor Author

I have an idea 😎 , let me rework this PR

@nickbalestra
Copy link
Contributor Author

nickbalestra commented Aug 6, 2017

@matteofigus I've extended the options-sanitizer:
It now checks if a prefix exist (before sanitizing it) and if the baseUrl doesn't already contain the prefix. If both check succeed it it sanitize the baseUrl by appending the prefix to it.

This should avoid this being a braking change, and will make it possible to handle both cases:

  1. prefix given and baseUrl given already containing prefix
  2. prefix given and baseUrl given without prefix

Let me know what you think

@nickbalestra
Copy link
Contributor Author

nickbalestra commented Aug 7, 2017

add

Copy link
Member

@matteofigus matteofigus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Can we just add a test for that?

@nickbalestra nickbalestra removed the wip label Aug 7, 2017
@nickbalestra
Copy link
Contributor Author

@matteofigus do want to review this one more time before 🌴 🌞 🏄 🍺 🏖 ?

@nickbalestra
Copy link
Contributor Author

@mattiaerre to get into merge mood, what about starting with this? 😎

@nickbalestra
Copy link
Contributor Author

There are still a couple of issues that need to be addressed that seems the tests didn't cought:
if prefix && baseUrl contiene prefix, niente duplicate prefix...
I'll need to add more tests to cover also this scenario

Copy link
Member

@mattiaerre mattiaerre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

over to you @nickbalestra the cov report shows that there are a lot of else paths missing. also I don't think we should set beforePublish within this component

@nickbalestra
Copy link
Contributor Author

@mattiaerre I've rebased and added the scenario based tests for the the baseUrl/Prefix.

I'll rather keep this PR scoped on solving this very small 'bug' that we discovered with the heroku get started registry.
I therefore suggest we don't addd jest or takle other aspects of the sanitization like beforePublish yet. (Also no need to add jest to have snapshots as those are now avail for any test runner).

Can you open an issue for the beforePublish? Ffor jest we already have #473
If Ok i'll revert the commit that added jest.

@nickbalestra nickbalestra changed the title Registry webUI: preview route/view bug [OC-120] Registry webUI: preview route/view bug Aug 11, 2017
@nickbalestra
Copy link
Contributor Author

@mattiaerre this should be now ready to go.
I'll update the OpenComponents website registry and the get-started repo once this is merged. Thanks!

Copy link
Member

@mattiaerre mattiaerre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some typos but this LGTM

test/fixtures/targz-test
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

me love this!

@@ -69,4 +76,48 @@ describe('registry : domain : options-sanitiser', () => {
});
});
});

describe('prefix and baseUrl sanitaziation', () => {
const prefixAndBaseUrlSchenario = [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

love it!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo prefixAndBaseUrlSchenario => prefixAndBaseUrlScenarios

@@ -7,7 +7,7 @@ describe('registry : domain : options-sanitiser', () => {
const sanitise = require('../../src/registry/domain/options-sanitiser');

describe('when options is empty', () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is no longer the description for this test is it?

@@ -69,4 +76,48 @@ describe('registry : domain : options-sanitiser', () => {
});
});
});

describe('prefix and baseUrl sanitaziation', () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo sanitaziation => sanitization

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants