1
exercism fetch ecmascript pig-latin

pig-latin.spec.js

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import PigLatin from './pig-latin';

describe('Pig Latin', () => {
  const translator = new PigLatin();

  test('translates a word beginning with a', () => {
    expect(translator.translate('apple')).toEqual('appleay');
  });

  xtest('translates a word beginning with e', () => {
    expect(translator.translate('ear')).toEqual('earay');
  });

  xtest('translates a word beginning with p', () => {
    expect(translator.translate('pig')).toEqual('igpay');
  });

  xtest('translates a word beginning with k', () => {
    expect(translator.translate('koala')).toEqual('oalakay');
  });

  xtest('translates a word beginning with ch', () => {
    expect(translator.translate('chair')).toEqual('airchay');
  });

  xtest('translates a word beginning with qu', () => {
    expect(translator.translate('queen')).toEqual('eenquay');
  });

  xtest('translates a word with a consonant preceding qu', () => {
    expect(translator.translate('square')).toEqual('aresquay');
  });

  xtest('translates a word beginning with th', () => {
    expect(translator.translate('therapy')).toEqual('erapythay');
  });

  xtest('translates a word beginning with thr', () => {
    expect(translator.translate('thrush')).toEqual('ushthray');
  });

  xtest('translates a word beginning with sch', () => {
    expect(translator.translate('school')).toEqual('oolschay');
  });

  xtest('translates a phrase', () => {
    expect(translator.translate('quick fast run'))
      .toEqual('ickquay astfay unray');
  });
});