forked from speechmarkdown/speechmarkdown-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmultiple-modifiers-same-text.spec.ts
122 lines (90 loc) · 3 KB
/
multiple-modifiers-same-text.spec.ts
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
// tslint:disable-next-line:import-name
import dedent from 'ts-dedent';
import { SpeechMarkdown } from '../src/SpeechMarkdown';
describe('multiple-modifiers-same-text', () => {
const speech = new SpeechMarkdown();
const markdown = dedent`
Your balance is: (12345)[number;emphasis:"strong";whisper;pitch:"high"].
`;
test('converts to SSML - Amazon Alexa', () => {
const options = {
platform: 'amazon-alexa'
};
const ssml = speech.toSSML(markdown, options);
const expected = dedent`
<speak>
Your balance is: <emphasis level="strong"><say-as interpret-as="number"><prosody pitch="high"><amazon:effect name="whispered">12345</amazon:effect></prosody></say-as></emphasis>.
</speak>
`;
expect(ssml).toBe(expected);
});
test('converts to SSML - Amazon Polly', () => {
const options = {
platform: 'amazon-polly'
};
const ssml = speech.toSSML(markdown, options);
const expected = dedent`
<speak>
Your balance is: <emphasis level="strong"><say-as interpret-as="number"><prosody pitch="high"><amazon:effect name="whispered">12345</amazon:effect></prosody></say-as></emphasis>.
</speak>
`;
expect(ssml).toBe(expected);
});
test('converts to SSML - Amazon Polly (Neural)', () => {
const options = {
platform: 'amazon-polly-neural'
};
const ssml = speech.toSSML(markdown, options);
const expected = dedent`
<speak>
Your balance is: <say-as interpret-as="number">12345</say-as>.
</speak>
`;
expect(ssml).toBe(expected);
});
test('converts to SSML - Google Assistant', () => {
const options = {
platform: 'google-assistant'
};
const ssml = speech.toSSML(markdown, options);
const expected = dedent`
<speak>
Your balance is: <emphasis level="strong"><say-as interpret-as="number"><prosody volume="x-soft" rate="slow" pitch="high">12345</prosody></say-as></emphasis>.
</speak>
`;
expect(ssml).toBe(expected);
});
test('converts to SSML - Samsung Bixby', () => {
const options = {
platform: 'samsung-bixby'
};
const ssml = speech.toSSML(markdown, options);
const expected = dedent`
<speak>
Your balance is: <say-as interpret-as="cardinal"><prosody volume="x-soft" rate="slow" pitch="high">12345</prosody></say-as>.
</speak>
`;
expect(ssml).toBe(expected);
});
test('converts to SSML - Microsoft Azure', () => {
const options = {
platform: 'microsoft-azure'
};
const ssml = speech.toSSML(markdown, options);
const expected = dedent`
<speak>
Your balance is: <say-as interpret-as="cardinal"><prosody volume="x-soft" rate="slow" pitch="high">12345</prosody></say-as>.
</speak>
`;
expect(ssml).toBe(expected);
});
test('converts to Plain Text', () => {
const options = {
};
const text = speech.toText(markdown, options);
const expected = dedent`
Your balance is: 12345.
`;
expect(text).toBe(expected);
});
});