Skip to content

Commit

Permalink
Tests: Added goToLink()
Browse files Browse the repository at this point in the history
  • Loading branch information
AurelioDeRosa committed May 18, 2016
1 parent e307457 commit ddb9a81
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions test/spec/main.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,54 @@ describe('WebReader', () => {
});
});

describe('goToLink()', () => {
context('without a previously spoken element', () => {
let webReader;

before(() => {
webReader = new WebReader();
});

it('should thrown an expection', () => {
assert.throws(() => {
webReader.goToLink()
}, WebReaderError);
});
});

context('with the last spoken element being a link', () => {
it('should navigate to the page specified by the href attribute of the link');
});

context('with the last spoken element different from a link', () => {
let stub;

before(() => {
stub = sinon
.stub(webReader.speaker, 'speak')
.returns(Promise.resolve());
});

beforeEach(() => {
return webReader.readMain();
});

afterEach(() => {
stub.reset();
});

after(() => {
stub.restore();
});

it('should thrown an exception', () => {
assert.throws(() => {
webReader.goToLink()
}, WebReaderError);
});
});
});

describe('readLinks()', () => {
let stub;

Expand Down

0 comments on commit ddb9a81

Please sign in to comment.