Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add Australian English helper method #55

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ const turkish = voices.turkish()
const american = voice.american()
const brazilian = voice.brazilian()
const british = voices.british()
const australian = voices.australian()

```

Expand Down Expand Up @@ -182,7 +183,7 @@ To run the tests, go to the terminal and enter:
- [ ] Implement a helper for `Swedish`
- [ ] Implement a helper for `Indian English`
- [ ] Implement a helper for `Canadian French`
- [ ] Implement a helper for `Australian English`
- [x] Implement a helper for `Australian English`
- [ ] Implement a helper for `Romanian`
- [x] Implement a helper for `Turkish`
- [ ] Implement a helper for `French`
Expand Down
4 changes: 4 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ export default class Voices {
return this.byLangCode('en-US')
}

australian () {
return this.byLangCode("en-AU")
chgasparoto marked this conversation as resolved.
Show resolved Hide resolved
}

brazilian () {
return this.byLangCode('pt-BR')
}
Expand Down
28 changes: 28 additions & 0 deletions test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,20 @@ const mockVoices = [{
Id: 'Justin',
LanguageCode: 'en-GB'
},
{
Gender: 'Female',
Name: 'Nicole',
LanguageName: 'Australian English',
Id: 'Nicole',
LanguageCode: 'en-AU'
},
{
Gender: 'Male',
Name: 'Russell',
LanguageName: 'Australian English',
Id: 'Russell',
LanguageCode: 'en-AU'
},
{
Gender: 'Female',
Name: 'Maja',
Expand Down Expand Up @@ -168,6 +182,20 @@ describe('Voices', () => {
spy.mockRestore()
})

test('it should return AUSTRALIAN ENGLISH voice data', () => {
const spy = jest.spyOn(voices, 'byLangCode')
const australian = voices.australian()

expect(australian.val).toBeArray()
expect(australian.val[0]).toBeObject()
expect(australian.val[0]).toContainAllKeys(voiceObjectKeys)
expect(australian.id).toBeString()

expect(spy).toHaveBeenCalledWith('en-AU')

spy.mockRestore()
})

test('it should return RUSSIAN voice data', () => {
const spy = jest.spyOn(voices, 'byLangCode')
const russian = voices.russian()
Expand Down