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

Extract examples from new-style services #1582

Merged
merged 7 commits into from
Mar 30, 2018
Merged

Extract examples from new-style services #1582

merged 7 commits into from
Mar 30, 2018

Conversation

paulmelnikow
Copy link
Member

Instead of centralizing examples, specify them from within a service.

Instead of centralizing examples, specify them from within a service.
@shields-ci
Copy link

shields-ci commented Mar 19, 2018

Warnings
⚠️

This PR modified package.json, but not package-lock.json - Perhaps you need to run npm install?

⚠️

This PR modified the server but none of the service tests. That's okay so long as it's refactoring existing code.

Messages
📖

✨ Thanks for your contribution to Shields, @paulmelnikow!

📖

Thanks for contributing to our documentation. We ❤️ our documentarians!

Generated by 🚫 dangerJS

@paulmelnikow paulmelnikow added frontend The Docusaurus app serving the docs site core Server, BaseService, GitHub auth, Shared helpers labels Mar 19, 2018
Copy link
Member

@chris48s chris48s left a comment

Choose a reason for hiding this comment

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

made a couple of suggestions, but even without them this is looking strong


const allBadgeExamples = require('./all-badge-examples');

describe('The badge examples', function () {
Copy link
Member

Choose a reason for hiding this comment

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

Do you think its worth having another test here which just iterates over all examples (rather than just the appveyor ones) and runs prepareExample() on each one. It doesn't have to assert anything other than an error wasn't thrown. That way we'll get a failure on the server tests if an invalid example (without a previewUri) is added in a PR.

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm, that's a good idea, though I think this is already happening when this file is required, on account of the call to loadExamples().

Copy link
Member

Choose a reason for hiding this comment

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

one step ahead of me :)

name: 'Branch',
uri: '/appveyor/ci/gruntjs/grunt/master',
title: 'branch',
previewUri: '/appveyor/ci/gruntjs/grunt/master',
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 a minor duplication, but given we define a base URI pattern in the service class I wonder if there is a way we could define the examples here as gruntjs/grunt/master or { 'repo': 'gruntjs/grunt', 'branch': 'master' } without needing to repeat /appveyor/ci in each example?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yup, that makes a lot of sense!

Copy link
Member Author

Choose a reason for hiding this comment

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

I pushed an update. Could you take a look?

It's cool that you brought up { 'repo': 'gruntjs/grunt', 'branch': 'master' }. I've started some experimentation with path-to-regexp which has a compile function that will help with this. I didn't quite get it working but my progress was promising!

@chris48s
Copy link
Member

I'll will have a proper look at this one tomorrow

Copy link
Member

@chris48s chris48s left a comment

Choose a reason for hiding this comment

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

I think this is good to go 👍

@paulmelnikow paulmelnikow merged commit ac7c418 into badges:master Mar 30, 2018
@paulmelnikow paulmelnikow deleted the base-service-examples branch March 30, 2018 08:07
paulmelnikow added a commit that referenced this pull request Apr 2, 2018
This cleans up the work from #1582, clarifying concerns, removing a bit of duplication, and renaming for clarity.
@Daniel15
Copy link
Member

Daniel15 commented Apr 8, 2018

Nice! Thanks for continuing to work on this 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Server, BaseService, GitHub auth, Shared helpers frontend The Docusaurus app serving the docs site
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants