2021-04-30 09:54:46 +00:00
const pigLatin = require ( './pigLatin' )
2021-04-30 09:49:46 +00:00
// Topics
// * modules
// * strings
// Pig Latin
2021-05-13 01:45:11 +00:00
// Pig Latin is a made-up children's language that's intended to be confusing. It obeys a few simple rules (below) but when it's spoken quickly it's really difficult for non-children (and non-native speakers) to understand.
2021-04-30 09:49:46 +00:00
// Rule 1: If a word begins with a vowel sound, add an "ay" sound to the end of the word.
2021-05-13 01:45:11 +00:00
// Rule 2: If a word begins with a consonant sound, move it to the end of the word, and then add an "ay" sound to the end of the word.
2021-04-30 09:49:46 +00:00
// (There are a few more rules for edge cases, and there are regional variants too, but that should be enough to understand the tests.)
// See https://en.wikipedia.org/wiki/Pig_Latin for more details.
describe ( 'translate' , ( ) => {
test ( 'translates a word beginning with a vowel' , ( ) => {
2021-05-10 09:27:55 +00:00
expect ( pigLatin ( "apple" ) ) . toBe ( 'appleay' ) ;
2021-04-30 09:49:46 +00:00
} ) ;
test . skip ( 'translates a word beginning with a consonant' , ( ) => {
2021-05-10 09:27:55 +00:00
expect ( pigLatin ( "banana" ) ) . toBe ( "ananabay" ) ;
2021-04-30 09:49:46 +00:00
} ) ;
test . skip ( 'translates a word beginning with two consonants' , ( ) => {
2021-05-10 09:27:55 +00:00
expect ( pigLatin ( "cherry" ) ) . toBe ( 'errychay' ) ;
2021-04-30 09:49:46 +00:00
} ) ;
test . skip ( 'translates two words' , ( ) => {
2021-05-10 09:27:55 +00:00
expect ( pigLatin ( "eat pie" ) ) . toBe ( 'eatay iepay' ) ;
2021-04-30 09:49:46 +00:00
} ) ;
test . skip ( 'translates a word beginning with three consonants' , ( ) => {
2021-05-10 09:27:55 +00:00
expect ( pigLatin ( "three" ) ) . toBe ( "eethray" ) ;
2021-04-30 09:49:46 +00:00
} ) ;
test . skip ( 'counts "sch" as a single phoneme' , ( ) => {
2021-05-10 09:27:55 +00:00
expect ( pigLatin ( "school" ) ) . toBe ( "oolschay" ) ;
2021-04-30 09:49:46 +00:00
} ) ;
test . skip ( 'counts "qu" as a single phoneme' , ( ) => {
2021-05-10 09:27:55 +00:00
expect ( pigLatin ( "quiet" ) ) . toBe ( "ietquay" ) ;
2021-04-30 09:49:46 +00:00
} ) ;
test . skip ( 'counts "qu" as a consonant even when its preceded by a consonant' , ( ) => {
2021-05-10 09:27:55 +00:00
expect ( pigLatin ( "square" ) ) . toBe ( "aresquay" ) ;
2021-04-30 09:49:46 +00:00
} ) ;
test . skip ( 'translates many words' , ( ) => {
2021-05-10 09:27:55 +00:00
expect ( pigLatin ( "the quick brown fox" ) ) . toBe ( "ethay ickquay ownbray oxfay" ) ;
2021-04-30 09:49:46 +00:00
} ) ;
} ) ;