Skip to content
This repository was archived by the owner on Jun 24, 2019. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
8f8ed4c
Fixed ratio help for operators
pratyushmittal Jun 25, 2016
e5f25b9
Updated packages
pratyushmittal Jun 25, 2016
33341be
Updated Packages. Tests migrated to new version.
pratyushmittal Jun 26, 2016
dda3dd5
Updated to new syntax
pratyushmittal Jun 26, 2016
8449b0b
Added missed categories
pratyushmittal Jun 26, 2016
3ce6674
Updated company search to new syntax
pratyushmittal Jun 28, 2016
4df88b6
Added tests for results table
pratyushmittal Jun 28, 2016
02ca19b
Add an option to compare Annual Results of a company with another com…
haveri Jul 6, 2016
52737fd
Refractorered some code to make it aesthetics modifications easier in…
pratyushmittal Jul 7, 2016
db0b47b
Fixed test warnings
pratyushmittal Jul 7, 2016
cb18700
Fixed url parsing for comparison company
pratyushmittal Jul 7, 2016
c761b02
Refractored code to make loading explicit
pratyushmittal Jul 7, 2016
96fb42c
Added section gaps in code as well
pratyushmittal Jul 7, 2016
d8008ec
Changed syntax to new class component for better PropTypes validation
pratyushmittal Jul 7, 2016
2c17085
Added tests for schedule expansion
pratyushmittal Jul 7, 2016
6d89519
Simplified the compare algorithm
pratyushmittal Jul 7, 2016
000f296
Added support for multiple comparisons
pratyushmittal Jul 7, 2016
e8fc272
Improved css
pratyushmittal Jul 7, 2016
3cee29c
Improved css
pratyushmittal Jul 8, 2016
c2b6757
Tests passing
pratyushmittal Jul 11, 2016
585c35e
Fixed page refresh at home
pratyushmittal Jul 11, 2016
60acb5e
Allow users to update existing screens by updating queries used for t…
haveri Jul 24, 2016
82eed08
Fix button sequence to ensure default is to save as new screen when u…
haveri Jul 24, 2016
802b27b
Update form fields for screens owned by user
haveri Jul 25, 2016
836c4f9
Populate Update Param only when required
pratyushmittal Aug 30, 2016
89e4aed
Fixed Checkbox uncontrolled to controlled warning
pratyushmittal Aug 30, 2016
eb4cc9b
Added tests
pratyushmittal Sep 16, 2016
9423340
Updated Jest Tests and outdated packages
pratyushmittal Sep 16, 2016
b95415b
Fixed peer result_type
pratyushmittal Oct 16, 2016
c7857ed
Updated packages
pratyushmittal Oct 16, 2016
90c66c1
Fixed IE errors
pratyushmittal Oct 19, 2016
a7a2691
updated index
pratyushmittal Mar 2, 2017
55e91bc
Fixed bse announcements link
pratyushmittal Apr 6, 2017
47b7e87
Updated home page
pratyushmittal Sep 18, 2017
852de42
Moved from require to import
pratyushmittal Nov 1, 2017
4c61b5d
Added package file
pratyushmittal Nov 1, 2017
e5582e4
Removed old node version for tests
pratyushmittal Nov 1, 2017
85dbb7d
Updated home
pratyushmittal Nov 16, 2017
927e785
Added home url
pratyushmittal Nov 16, 2017
c03126e
Updated versions
pratyushmittal Nov 16, 2017
6cfe5c5
Removed talks link
pratyushmittal Dec 13, 2017
c55dcba
Synced to latest changes in API
pratyushmittal Apr 11, 2018
5141b4f
Updated package
pratyushmittal Apr 11, 2018
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: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
language: node_js
node_js:
- "5.1.0"
- "4.2.2"
30 changes: 30 additions & 0 deletions app/__tests__/__snapshots__/api-tests.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
exports[`test REST apis calls the get api 1`] = `
Array [
Array [
"/api/users/me/",
Object {
"credentials": "same-origin",
"headers": Object {
"Accept": "application/json",
},
"method": "get",
},
],
]
`;

exports[`test REST apis calls the post api 1`] = `
Array [
Array [
"/logout/",
Object {
"credentials": "same-origin",
"headers": Object {
"Accept": "application/json",
"X-CSRFToken": "",
},
"method": "post",
},
],
]
`;
49 changes: 16 additions & 33 deletions app/__tests__/api-tests.js
Original file line number Diff line number Diff line change
@@ -1,49 +1,33 @@
"use strict";
jest.autoMockOff();
jest.mock('fetch-on-rest');
import api from '../api.js'

describe('test REST apis', function () {
var api = require('app/api.js');

afterEach(function() {
beforeEach(() => {
window.fetch.mockClear()
})

afterEach(() => {
expect(api.getPending()).toEqual([]);
});

pit('calls the get api', function() {
it('calls the post api', function() {
api.setResponse('/logout/', JSON.stringify({}));
return api.logout().then(() => {
expect(window.fetch.mock.calls).toMatchSnapshot()
});
});

it('calls the get api', function() {
api.setResponse('/api/users/me/', JSON.stringify({foo: 'bar'}));
return api.get(api.me).then(resp => {
expect(resp).toEqual({foo: 'bar'});
expect(window.fetch.mock.calls.length).toBe(1);
expect(window.fetch.mock.calls[0][0]).toEqual('/api/users/me/');
var headers = {
credentials: 'same-origin',
headers: {
Accept: 'application/json'
},
method: 'get'
};
expect(window.fetch.mock.calls[0][1]).toEqual(headers);
expect(window.fetch.mock.calls).toMatchSnapshot()
})
});

pit('calls the post api', function() {
api.setResponse('/logout/', JSON.stringify({}));
return api.logout().then(() => {
expect(window.fetch.mock.calls.length).toBe(1);
expect(window.fetch.mock.calls[0][0]).toEqual('/logout/');
var headers = {
credentials: 'same-origin',
headers: {
Accept: 'application/json',
'X-CSRFToken': ''
},
method: 'post'
};
expect(window.fetch.mock.calls[0][1]).toEqual(headers);
});
});

pit('calls the delete api', function() {
it('calls the delete api', function() {
api.setResponse('/api/screens/33/?foo=bar', "{}");
return api.delete(['screens', 33], {foo: 'bar'}).then(() => {
expect(window.fetch).toBeCalledWith(
Expand All @@ -64,7 +48,6 @@ describe('test REST apis', function () {

describe('test dependent libraries', function(){
it('checks expansions', function() {
var api = require('app/api.js');
expect(api._getUrl(api.me)).toEqual('/api/users/me/');
expect(api._getUrl(api.me, {})).toEqual('/api/users/me/');
expect(api._getUrl(api.me, {foo: 'bar'})).toEqual('/api/users/me/?foo=bar');
Expand Down
37 changes: 16 additions & 21 deletions app/__tests__/watchlist-tests.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
'use strict';
jest.autoMockOff();
jest.mock('fetch-on-rest');


var screen = {
jest.disableAutomock()
jest.mock('fetch-on-rest')
import api from '../api.js'
import React from 'react'
import ReactDOM from 'react-dom'
import Watchlist from '../watchlist.jsx'
import TestUtils from 'react-addons-test-utils'

var SCREEN = {
ratios: [[
"Current price",
"CMP",
Expand All @@ -15,19 +19,17 @@ var screen = {
};

describe('watchlist Tests', function() {
var api = require('app/api.js');
var watchlist, TestUtils;
var watchlist

beforeEach(function() {
var React = require('react');
var Watchlist = require('../watchlist.jsx');
window.loggedIn = true;
TestUtils = require('react-addons-test-utils');
var params = {
search: '',
query: {},
pathname: '/watchlist/'
};
window.loggedIn = true;
api.setResponse('/api/users/watchlist/',
JSON.stringify(SCREEN));
watchlist = TestUtils.renderIntoDocument(
<Watchlist location={params}/>
);
Expand All @@ -37,21 +39,14 @@ describe('watchlist Tests', function() {
expect(api.getPending()).toEqual([]);
});

it('should show loading', function() {
var ReactDOM = require('react-dom');
it('should load watchlist', function() {
var dom = ReactDOM.findDOMNode(watchlist);
expect(dom.textContent).toEqual('Loading...');
});

pit('should load watchlist', function() {
api.setResponse('/api/users/watchlist/',
JSON.stringify(screen));
return watchlist.componentDidMount().then(() => {
expect(watchlist.state.screen).toEqual(screen);
return watchlist._req.then(() => {
expect(watchlist.state.screen).toEqual(SCREEN);
var table = TestUtils.findRenderedDOMComponentWithTag(
watchlist, 'table');
expect(table).toBeDefined();
});
});

});
4 changes: 2 additions & 2 deletions app/api.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"use strict";
var Rest = require('fetch-on-rest');
import Rest from 'fetch-on-rest'

function getCookie(sKey) {
if (!sKey) { return ''; }
Expand Down Expand Up @@ -54,4 +54,4 @@ Api.cid = function(cid, component) {
return ['company', cid, component];
};

module.exports = Api;
export default Api
25 changes: 11 additions & 14 deletions app/base.jsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
"use strict";
var React = require('react');
var Link = require('react-router').Link;
var Nav = require('react-bootstrap/lib/Nav');
var Navbar = require('react-bootstrap/lib/Navbar');
var NavbarBrand = require('react-bootstrap/lib/NavbarBrand');
import React from 'react'
import {Link} from 'react-router'
import Nav from 'react-bootstrap/lib/Nav'
import Navbar from 'react-bootstrap/lib/Navbar'
import NavbarBrand from 'react-bootstrap/lib/NavbarBrand'

var CompanySearch = require('./components/company.search.jsx');
var Api = require('./api.js');
import CompanySearch from './components/company.search.jsx'
import Api from './api.js'


function Footer() {
Expand All @@ -16,9 +15,8 @@ function Footer() {
Made with <i className="glyphicon glyphicon-heart" /> in <b>India</b>.
</span>
<p>
Navigation Links: <Link to="/">Home
Navigation Links: <Link to="/home/">Home
</Link> | <Link to="/screens/">Screens
</Link> | <Link to="/talks/">Talks
</Link> | <a href="http://blog.screener.in">Change Log
</a> | <a href="http://dalal-street.in">Dalal-Street Blog
</a> | <a href="https://github.com/Mittal-Analytics/Screener.in">
Expand Down Expand Up @@ -108,14 +106,13 @@ class Navigation extends React.Component {
</div>

<Navbar.Collapse>
<Nav eventKey={0}>
<Nav>
<li className="visible-lg-block">
<a href="http://dalal-street.in">Blog</a>
</li>
<li className="visible-lg-block"><a href="http://blog.screener.in">
{this.state.user.id ? 'Change Log' : 'Features'}
</a></li>
<li><Link to="/talks/">Talks</Link></li>
<li><Link to="/screens/">Screens</Link></li>
<li><Link to="/watchlist/">Watchlist</Link></li>
</Nav>
Expand All @@ -133,5 +130,5 @@ Navigation.contextTypes = {
}


module.exports.Navigation = Navigation;
module.exports.Footer = Footer;
export { Navigation }
export { Footer }
29 changes: 7 additions & 22 deletions app/company/__tests__/misc-tests.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
"use strict";
jest.autoMockOff();
jest.mock('fetch-on-rest');
import React from 'react'
import ReactDOM from 'react-dom'
import TestUtils from 'react-addons-test-utils'
import {CompanyHeader} from '../misc.jsx'

var kitex = {
id: 1950,
Expand Down Expand Up @@ -29,28 +31,11 @@ var kitex = {


describe('Walk tests', function () {
var api = require('app/api.js');
var Misc, TestUtils, api, ReactDOM, React;

beforeEach(function() {
React = require('react');
ReactDOM = require('react-dom');
TestUtils = require('react-addons-test-utils');
Misc = require.requireActual('../misc.jsx');
});

afterEach(function() {
expect(api.getPending()).toEqual([]);
});

it('test visible add to watchlist button', function() {
var dummy = jest.genMockFunction().mockImplementation(
function(cid) {
return api.post(['company', cid, 'favorite']);
}
);
var dummy = jest.genMockFunction()
var header = TestUtils.renderIntoDocument(<div>
<Misc.CompanyHeader
<CompanyHeader
company={kitex}
favorites={[1, 2]}
handleFavorite={dummy}
Expand All @@ -65,7 +50,7 @@ describe('Walk tests', function () {

// button hiddend when in favorites
header = TestUtils.renderIntoDocument(<div>
<Misc.CompanyHeader
<CompanyHeader
company={kitex}
favorites={[1950, 2]}
handleFavorite={dummy}
Expand Down
30 changes: 18 additions & 12 deletions app/company/__tests__/peers-tests.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
"use strict";
jest.autoMockOff();
jest.disableAutomock();
jest.mock('fetch-on-rest');
import api from '../../api.js'
import React from 'react'
import ReactDOM from 'react-dom'
import TestUtils from 'react-addons-test-utils'
import Peers from '../peers.jsx'

describe('Peers tests', function () {
var api = require('app/api.js');
var peerResults = {
ratios: [],
results: []
Expand All @@ -13,18 +17,20 @@ describe('Peers tests', function () {
expect(api.getPending()).toEqual([]);
});

pit('renders a peers table', function() {
var React = require('react');
var ReactDOM = require('react-dom');
var TestUtils = require('react-addons-test-utils');
var Peers = require('../peers.jsx');
var props = {wid: 22, industry: 'Hi', short_name: 'hi'};
var peers = TestUtils.renderIntoDocument(
<Peers {...props} />
);
it('renders a peers table', function() {
var company = {
short_name: 'hi',
warehouse_set: {
id: 22,
industry: 'Hi'
}
}
api.setResponse('/api/company/22/peers/?industry=Hi',
JSON.stringify(peerResults));
return peers.componentDidMount().then(() => {
var peers = TestUtils.renderIntoDocument(
<Peers company={company} />
);
return peers._req.then(() => {
var dom = ReactDOM.findDOMNode(peers);
expect(dom.textContent).toContain('Peer Comparison ');
})
Expand Down
Loading