This repository was archived by the owner on Aug 1, 2021. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 160
reworked pangram spec #406
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,50 +1,61 @@ | ||
| var Pangram = require('./pangram'); | ||
|
|
||
| describe('Pangram()', function() { | ||
| describe('Tests the Pangram checker.', function() { | ||
|
|
||
| it('empty sentence', function() { | ||
| it('can handle an empty sentence', function() { | ||
| var pangram = new Pangram(''); | ||
| expect(pangram.isPangram()).toBe(false); | ||
| }); | ||
|
|
||
| xit('pangram with only lower case', function() { | ||
| var pangram = new Pangram("the quick brown fox jumps over the lazy dog"); | ||
| expect(pangram.isPangram()).toBe(true); | ||
| xit('handles an undefined message as empty message', function() { | ||
| var pangram = new Pangram(); | ||
| expect(pangram.isPangram()).toBe(false); | ||
| }); | ||
|
|
||
| xit("missing character 'x'", function() { | ||
| var pangram = new Pangram("a quick movement of the enemy will jeopardize five gunboats"); | ||
| expect(pangram.isPangram()).toBe(false); | ||
| xit('recognizes a lower case pangram', function() { | ||
| var pangram = new Pangram('thequickbrownfoxjumpsoverthelazydog'); | ||
| expect(pangram.isPangram()).toBe(true); | ||
| }); | ||
|
|
||
| xit("another missing character 'x'", function() { | ||
| var pangram = new Pangram("the quick brown fish jumps over the lazy dog"); | ||
| xit('recognizes a missing character', function() { | ||
| // missing 'x' | ||
| var pangram = new Pangram('aquickmovementoftheenemywilljeopardizefivegunboats'); | ||
| expect(pangram.isPangram()).toBe(false); | ||
| // missing 'h' | ||
| var pangram = new Pangram('fiveboxingwizardsjumpquicklyatit'); | ||
| expect(pangram.isPangram()).toBe(false); | ||
| }); | ||
|
|
||
| xit("pangram with underscores", function() { | ||
| var pangram = new Pangram("the_quick_brown_fox_jumps_over_the_lazy_dog"); | ||
| xit('recognizes an upper case pangram', function() { | ||
| var pangram = new Pangram('THEQUICKBROWNFOXJUMPSOVERTHELAZYDOG'); | ||
| expect(pangram.isPangram()).toBe(true); | ||
| // missing 'G' | ||
| var pangram = new Pangram('THEQUICKBROWNFOXJUMPSOVERTHELAZYDOLL'); | ||
| expect(pangram.isPangram()).toBe(false); | ||
| }); | ||
|
|
||
| xit("pangram with numbers", function() { | ||
| var pangram = new Pangram("the 1 quick brown fox jumps over the 2 lazy dogs"); | ||
| xit('recognizes a mixed case pangram', function() { | ||
| var pangram = new Pangram('ThEFiVebOxInGWiZaRdSJuMpqUiCkLy'); | ||
| expect(pangram.isPangram()).toBe(true); | ||
| }); | ||
|
|
||
| xit('missing letters replaced by numbers', function() { | ||
| var pangram = new Pangram("7h3 qu1ck brown fox jumps ov3r 7h3 lazy dog"); | ||
| // missing 'y' | ||
| var pangram = new Pangram('ThEFiVebOxInGWiZaRdSJuMpqUiCkL'); | ||
| expect(pangram.isPangram()).toBe(false); | ||
| }); | ||
|
|
||
| xit('pangram with mixed case and punctuation', function() { | ||
| var pangram = new Pangram("\"Five quacking Zephyrs jolt my wax bed.\""); | ||
| xit('ignores other characters', function() { | ||
| var pangram = new Pangram('Victor_jagt-zwölf.B0xkämpfer >qu3r< über; den \'großen" Sylter#Deich!'); | ||
| expect(pangram.isPangram()).toBe(true); | ||
| // missing 'd' | ||
| var pangram = new Pangram('Victor_jagt-zwölf.B0xkämpfer >qu3r< über; einen \'großen" Sylter#Teich!'); | ||
| expect(pangram.isPangram()).toBe(false); | ||
| }); | ||
|
|
||
| xit('pangram with non-ascii characters', function() { | ||
| var pangram = new Pangram("Victor jagt zwölf Boxkämpfer quer über den großen Sylter Deich."); | ||
| xit('ignores non-ANSI characters', function() { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Trying to bring Unicode to devs attention. |
||
| var pangram = new Pangram('Few quips galvanized the ① mock 😮 jury box 🗃️.'); | ||
| expect(pangram.isPangram()).toBe(true); | ||
| // substituted 'v' with '℣' | ||
| var pangram = new Pangram('Few quips gal℣anized the ① mock 😮 jury box 🗃️.'); | ||
| expect(pangram.isPangram()).toBe(false); | ||
| }); | ||
|
|
||
| }); | ||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
had to add a missing null check