Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
290ddf6
Make test work again
tylerlong Jul 19, 2017
aed6746
Use react-test-renderer instead to eliminate warnings
tylerlong Jul 19, 2017
a603eb6
Add git prepush hook to run tests
tylerlong Jul 19, 2017
4de900d
Enable coveralls
tylerlong Jul 19, 2017
e0708c8
Update test folder structure
tylerlong Jul 19, 2017
00595e0
Try to write tests for alerts
tylerlong Jul 20, 2017
ff69466
First runnable jest mock test
tylerlong Jul 20, 2017
c1abc7e
Fix a typo
tylerlong Jul 20, 2017
8562f64
Fix test hang issue
tylerlong Jul 20, 2017
c43014f
Refactor test
tylerlong Jul 20, 2017
e387286
Use dotenv for test
tylerlong Jul 20, 2017
91de5a6
Refactor testing code
tylerlong Jul 20, 2017
e532b74
Fix typo in test description
tylerlong Jul 20, 2017
1a8ff2f
Generate jest snapshot
tylerlong Jul 24, 2017
cd5b765
Test DialTextInput
tylerlong Jul 24, 2017
5442195
Test dial page
tylerlong Jul 24, 2017
f55120e
Create DialerPanel tests
tylerlong Jul 24, 2017
5c8acc0
Check state value
tylerlong Jul 24, 2017
e68cb06
Test snapshot again
tylerlong Jul 24, 2017
a1f2ce4
Test a invalid phone number
tylerlong Jul 25, 2017
fd8f582
Enable test coverage
tylerlong Jul 25, 2017
7954abb
Mock css class names
tylerlong Jul 25, 2017
a8b71aa
Fix TextInput test
tylerlong Jul 25, 2017
2339718
More test cases for dialPanel
tylerlong Jul 25, 2017
5e4c7f5
Refactor testing code
tylerlong Jul 25, 2017
8d022e6
Merge branch 'master' into master
tylerlong Jul 25, 2017
bed2b92
Try to write more tests
tylerlong Jul 25, 2017
3890edf
Test code to switch panel
tylerlong Jul 25, 2017
bfc8f3e
Get ComponseTextPanel test correct
tylerlong Jul 25, 2017
fd7a592
Add some todo items
tylerlong Jul 25, 2017
bc05ad5
Update test configuration
tylerlong Jul 26, 2017
7a431d0
Refactor code
tylerlong Jul 26, 2017
2056531
Write tests for SettingsPanel
tylerlong Jul 26, 2017
3dfa389
Initial state for testing
tylerlong Jul 26, 2017
d659c55
Remove unused dependent libraries
tylerlong Jul 26, 2017
dfc9a53
Test settings page LinkLines
tylerlong Jul 26, 2017
30d5a15
Refactor code
tylerlong Jul 26, 2017
442fbcc
More tests for settings page
tylerlong Jul 26, 2017
e3563fb
Fix dotenv issue
tylerlong Jul 27, 2017
38ac24c
Test Logout
tylerlong Jul 27, 2017
e517f2a
jasmine.DEFAULT_TIMEOUT_INTERVAL
tylerlong Jul 27, 2017
3d20a83
Update eslintrc for jasmine
tylerlong Jul 27, 2017
6fe47d4
Test settings page change presence status
tylerlong Jul 27, 2017
fcb0516
getPhone and getWrapper are async
tylerlong Jul 27, 2017
acff14c
Avoid frequent login
tylerlong Jul 27, 2017
cbb16d2
More tests for change presence status
tylerlong Jul 27, 2017
cbe74e1
Refactor SettingsPanel tests
tylerlong Jul 28, 2017
db1fdc9
Refactor code
tylerlong Jul 28, 2017
07bf370
Merge branch 'master' into master
tylerlong Jul 28, 2017
c33aa72
Merge branch 'master' of github.com:tylerlong/ringcentral-js-widget
tylerlong Jul 28, 2017
588fd3b
jasmine.DEFAULT_TIMEOUT_INTERVAL = 32000;
tylerlong Jul 28, 2017
f93e05f
Print process.env to debug Travis
tylerlong Jul 28, 2017
5ce8e38
Refactor dotenv code
tylerlong Jul 28, 2017
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
1 change: 1 addition & 0 deletions .ackrc
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
--ignore-file=match:/^yarn\.lock$/
--ignore-dir=coverage
4 changes: 2 additions & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"env": {
"browser": true,
"webextensions": true,
"mocha": true,
"jest": true
"jest": true,
"jasmine": true
},
"rules": {
"class-methods-use-this": 0,
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,6 @@ node_modules
/dev-server/api-config.js
/localization
/demo-extension-build

.env
*.snap
7 changes: 4 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
language: node_js
node_js:
- '6'
- '7'
- '8'
# after_success:
# - 'cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js'
script:
- yarn test:coverage
after_success:
- cat ./coverage/lcov.info | ./node_modules/.bin/coveralls
before_deploy:
- ./scripts/prepare_release.sh && cd release
after_deploy:
Expand Down
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,14 @@ Open up your browser and access http://localhost:8191 to see how it works.

Note that the development server is using OAuth for authorization process.
Please make sure the app you specified in configuration above is setup with Redirect Uri `http://localhost:8191/redirect.html`.


## Test

Create `.env` file in `test`, with the following content:

```ini
appKey=your-appKey
appSecret=your-appSecret
server=sever_url
```
1 change: 0 additions & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import gulp from 'gulp';
import mocha from 'gulp-mocha';
import istanbul from 'gulp-istanbul';
import babelIstanbul from 'babel-istanbul';
import yargs from 'yargs';
Expand Down
45 changes: 33 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@
"description": "RingCentral Integration Widget Library",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 0",
"test": "jest",
"test:watch": "jest --watch",
"test:coverage": "jest --coverage",
"build": "node ./node_modules/babel-cli/bin/babel-node.js ./node_modules/gulp/bin/gulp.js build",
"gulp": "node ./node_modules/babel-cli/bin/babel-node.js ./node_modules/gulp/bin/gulp.js",
"dev-server": "node ./node_modules/babel-cli/bin/babel-node.js ./node_modules/gulp/bin/gulp.js dev-server",
"release": "node ./node_modules/babel-cli/bin/babel-node.js ./node_modules/gulp/bin/gulp.js release",
"eslint": "node ./node_modules/eslint/bin/eslint.js --quiet src --ignore-pattern *.test.js"
"eslint": "node ./node_modules/eslint/bin/eslint.js --quiet src --ignore-pattern *.test.js",
"prepush": "yarn test"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -48,11 +51,11 @@
"babel-preset-react": "^6.16.0",
"babel-preset-stage-0": "^6.16.0",
"babel-runtime": "^6.20.0",
"chai": "^4.0.2",
"chai-enzyme": "^0.7.1",
"coveralls": "^2.11.15",
"css-loader": "^0.28.4",
"enzyme": "^2.7.1",
"dotenv": "^4.0.0",
"enzyme": "^2.9.1",
"enzyme-to-json": "^1.5.1",
"eslint": "3.19.0",
"eslint-config-airbnb": "^15.0.1",
"eslint-plugin-import": "^2.2.0",
Expand All @@ -64,24 +67,26 @@
"gulp": "^3.9.1",
"gulp-babel": "^6.1.2",
"gulp-istanbul": "^1.1.1",
"gulp-mocha": "^3.0.1",
"gulp-sourcemaps": "^2.4.0",
"husky": "^0.14.3",
"identity-obj-proxy": "^3.0.0",
"intl": "^1.2.5",
"jest": "^20.0.4",
"json-loader": "^0.5.4",
"locale-loader": "^1.3.0",
"node-sass": "^4.5.3",
"postcss-loader": "^2.0.5",
"react": "^15.4.1",
"react": "^15.6.1",
"react-addons-perf": "^15.4.2",
"react-addons-test-utils": "^15.4.2",
"react-dom": "^15.4.1",
"react-redux": "^5.0.1",
"react-dom": "^15.6.1",
"react-redux": "^5.0.5",
"react-router": "^3.0.0",
"react-router-redux": "^4.0.7",
"react-svg-loader": "^1.1.1",
"redux": "^3.6.0",
"react-test-renderer": "^15.6.1",
"redux": "^3.7.2",
"redux-logger": "^3.0.6",
"redux-thunk": "^2.1.0",
"redux-thunk": "^2.2.0",
"ringcentral": "^3.1.1",
"ringcentral-client": "^1.0.0-rc1",
"ringcentral-integration": "^0.7.0-rc17",
Expand All @@ -104,5 +109,21 @@
"rc-tooltip": "^3.4.6",
"react-svg-loader": "^1.1.1",
"through2": "^2.0.3"
},
"jest": {
"moduleNameMapper": {
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga|ogg)$": "<rootDir>/test/__mocks__/fileMock.js",
"\\.(css|less|scss)$": "<rootDir>/test/__mocks__/styleMock.js"
},
"transform": {
"loadLocale\\.js$": "<rootDir>/test/__mocks__/loadLocale.js",
"^.+\\.js$": "babel-jest"
},
"setupFiles": [
"./test/setup.js"
],
"snapshotSerializers": [
"<rootDir>/node_modules/enzyme-to-json/serializer"
]
}
}
2 changes: 1 addition & 1 deletion src/components/DialPad/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const keyConfig = [

const ALTERNATIVE_TIMEOUT = 1000;

class DialButton extends Component {
export class DialButton extends Component {
constructor(props, ...args) {
super(props, ...args);
this.state = {
Expand Down
2 changes: 1 addition & 1 deletion src/components/PresenceSettingSection/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function getPresenceStatusName(currentUserStatus, currentDndStatus, currentLocal
return i18n.getString(currentUserStatus + currentDndStatus, currentLocale);
}

function PresenceItem(props) {
export function PresenceItem(props) {
const className = classnames(
styles.presenceItem,
props.selected ? styles.selected : null
Expand Down
73 changes: 0 additions & 73 deletions src/components/TextInput/index.test.js

This file was deleted.

31 changes: 0 additions & 31 deletions src/setupTests.js

This file was deleted.

29 changes: 29 additions & 0 deletions test/CallsPanel.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { Provider } from 'react-redux';
import { Router } from 'react-router';

import { getWrapper, getState } from './shared';
import CallsPanel from '../src/components/CallsPanel';
import NavigationBar from '../src/components/NavigationBar';

let wrapper = null;
let panel = null;
beforeEach(async () => {
jasmine.DEFAULT_TIMEOUT_INTERVAL = 32000;
wrapper = await getWrapper();
const navigationBar = wrapper.find(Provider).first()
.find(Router).first()
.find(NavigationBar)
.first();
await navigationBar.props().goTo('/history');
panel = wrapper.find(Provider).first()
.find(Router).first()
.find(CallsPanel)
.first();
});

describe('history', () => {
test('initial state', () => {
expect(panel).toBeDefined();
expect(panel.props()).toBeDefined();
});
});
34 changes: 34 additions & 0 deletions test/ComposeTextPanel.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { Provider } from 'react-redux';
import { Router } from 'react-router';

import { getWrapper, getState, timeout } from './shared';
import NavigationBar from '../src/components/NavigationBar';
import ComposeTextPanel from '../src/components/ComposeTextPanel';

let wrapper = null;
let panel = null;
beforeEach(async () => {
jasmine.DEFAULT_TIMEOUT_INTERVAL = 32000;
wrapper = await getWrapper();
const navigationBar = wrapper.find(Provider).first()
.find(Router).first()
.find(NavigationBar)
.first();
await navigationBar.props().goTo('/composeText');
panel = wrapper.find(Provider).first()
.find(Router).first()
.find(ComposeTextPanel)
.first();
});

describe('compose text panel', () => {
test('initial state', () => {
expect(panel).toBeDefined();
expect(panel.props()).toBeDefined();
// expect(panel).toMatchSnapshot();
});

test('send button status', () => {
// todo: need to login first
});
});
Loading