update tests, multiple exercises

This commit is contained in:
Michael Frank
2021-03-10 00:12:25 +13:00
parent e73c68fc01
commit 2eb02ea212
11 changed files with 161 additions and 172 deletions
+24 -22
View File
@@ -1,15 +1,17 @@
const expect = require("expect");// Topics
const expect = require("expect");
// Topics
// * modules
// * strings
// Pig Latin
// 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.
// Pig Latin is a made-up children's language that's intended to be confusing. test obeys a few simple rules (below) but when test's spoken quickly test's really difficult for non-children (and non-native speakers) to understand.
// Rule 1: If a word begins with a vowel sound, add an "ay" sound to the end of the word.
// 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.
// Rule 2: If a word begins with a consonant sound, move test to the end of the word, and then add an "ay" sound to the end of the word.
// (There are a few more rules for edge cases, and there are regional variants too, but that should be enough to understand the tests.)
@@ -17,48 +19,48 @@ const expect = require("expect");// Topics
const pigLatin = require("./pigLatin.js");
describe('#translate', function() {
it('translates a word beginning with a vowel', function() {
describe('translate', () => {
test('translates a word beginning with a vowel', () => {
s = pigLatin.translate("apple");
expect(s).toEqual('appleay');
expect(s).toBe('appleay');
});
xit('translates a word beginning with a consonant', function() {
test.skip('translates a word beginning with a consonant', () => {
s = pigLatin.translate("banana");
expect(s).toEqual("ananabay");
expect(s).toBe("ananabay");
});
xit('translates a word beginning with two consonants', function() {
test.skip('translates a word beginning with two consonants', () => {
s = pigLatin.translate("cherry");
expect(s).toEqual('errychay');
expect(s).toBe('errychay');
});
xit('translates two words', function() {
test.skip('translates two words', () => {
s = pigLatin.translate("eat pie");
expect(s).toEqual('eatay iepay');
expect(s).toBe('eatay iepay');
});
xit('translates a word beginning with three consonants', function() {
expect(pigLatin.translate("three")).toEqual("eethray");
test.skip('translates a word beginning with three consonants', () => {
expect(pigLatin.translate("three")).toBe("eethray");
});
xit('counts "sch" as a single phoneme', function() {
test.skip('counts "sch" as a single phoneme', () => {
s = pigLatin.translate("school");
expect(s).toEqual("oolschay");
expect(s).toBe("oolschay");
});
xit('counts "qu" as a single phoneme', function() {
test.skip('counts "qu" as a single phoneme', () => {
s = pigLatin.translate("quiet");
expect(s).toEqual("ietquay");
expect(s).toBe("ietquay");
});
xit('counts "qu" as a consonant even when its preceded by a consonant', function() {
test.skip('counts "qu" as a consonant even when its preceded by a consonant', () => {
s = pigLatin.translate("square");
expect(s).toEqual("aresquay");
expect(s).toBe("aresquay");
});
xit('translates many words', function() {
test.skip('translates many words', () => {
s = pigLatin.translate("the quick brown fox");
expect(s).toEqual("ethay ickquay ownbray oxfay");
expect(s).toBe("ethay ickquay ownbray oxfay");
});
});