Skip to content
This repository was archived by the owner on Jun 28, 2021. It is now read-only.
Merged
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
Prev Previous commit
action unit tests
  • Loading branch information
thabti committed Aug 4, 2016
commit 33d51b6fbc12da9cc69188c40a58deffcadd8ffe
43 changes: 43 additions & 0 deletions src/redux/actions/spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import * as audioplayerActions from './audioplayer.js';
import * as ayahsActions from './ayahs.js';
import * as surahsActions from './surahs.js';
import * as audioplayerConstant from '../constants/audioplayer.js';
import * as ayahsConstants from '../constants/ayahs.js';
import * as surahsConstants from '../constants/surahs.js';


describe("action tests", () => {

it("audioplayer actions", () => {
expect(audioplayerActions.setUserAgent('abc').type).to.equal(audioplayerConstant.SET_USER_AGENT);
expect(audioplayerActions.setCurrentFile('fil').type).to.equal(audioplayerConstant.SET_CURRENT_FILE);
expect(audioplayerActions.setCurrentWord('word').type).to.equal(audioplayerConstant.SET_CURRENT_WORD);
expect(audioplayerActions.play().type).to.equal(audioplayerConstant.PLAY);
expect(audioplayerActions.pause().type).to.equal(audioplayerConstant.PAUSE);
expect(audioplayerActions.next('abc').type).to.equal(audioplayerConstant.NEXT);
expect(audioplayerActions.previous('abc').type).to.equal(audioplayerConstant.PREVIOUS);
expect(audioplayerActions.setRepeat('abc').type).to.equal(audioplayerConstant.SET_REPEAT);
expect(audioplayerActions.toggleScroll().type).to.equal(audioplayerConstant.TOGGLE_SCROLL);
expect(audioplayerActions.buildOnClient('abc').type).to.equal(audioplayerConstant.BUILD_ON_CLIENT);
expect(audioplayerActions.update('abc').type).to.equal(audioplayerConstant.UPDATE);
});

it("ayahs actions", () => {
expect(ayahsActions.load(1, 2, 4).types.length).to.equal(3);
expect(ayahsActions.clearCurrent().type).to.equal(ayahsConstants.CLEAR_CURRENT);
expect(ayahsActions.clearCurrentWord(1).type).to.equal(ayahsConstants.CLEAR_CURRENT_WORD);
expect(ayahsActions.setCurrentAyah(1).type).to.equal(ayahsConstants.SET_CURRENT_AYAH);
expect(ayahsActions.setCurrentWord(1).type).to.equal(ayahsConstants.SET_CURRENT_WORD);
});

it("surahs actions", () => {
expect(surahsActions.loadAll().types.length).to.equal(3);
expect(surahsActions.load(1).types.length).to.equal(3);
expect(surahsActions.loadInfo('url').types.length).to.equal(3);
expect(surahsActions.setCurrent(1).type).to.equal(surahsConstants.SET_CURRENT);
});




});