Throw error on nonalphanumeric namespace#3
Open
goodmike wants to merge 2 commits intoprimaryobjects:masterfrom
Open
Throw error on nonalphanumeric namespace#3goodmike wants to merge 2 commits intoprimaryobjects:masterfrom
goodmike wants to merge 2 commits intoprimaryobjects:masterfrom
Conversation
Add dev dependency for tape test framework, npm test script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
[Closes #2]
Here's the PR to prevent users from accidentally choosing a namespace for a skill that will cause errors later.
I have 2 separate commits. The first sets up a minimal
tapetest environment and a single unit test for the error. If you're like me, you're more comfortable squashing a bug when there's a test to demonstrate it's fixed. However, if you don't want the dev dependency ontape, which also pulls a number of other packages in (even though it's supposed to be the lightweight testing alternative), or you prefer a different library likemochaorjasmine, feel free to ask me to discard or change this commit.The second commit has the actual edit to
chatskills.js. I decided to keep it as simple as I could, so I have a RegExp test for non-alphanumerics. I did not extract the namespace part of the RegExp expression in thesessionmethod because I think it would be difficult to use the partial pattern both in theaddmethod and thesessionmethod. I don't think RegExps do not compose easily. Again, if you'd prefer I try to DRY things out, let me know.