Skip to content

Instantly share code, notes, and snippets.

@ktusznio
Created August 19, 2015 21:27
Show Gist options
  • Save ktusznio/598a6a82e8e2a1cdcf55 to your computer and use it in GitHub Desktop.
Save ktusznio/598a6a82e8e2a1cdcf55 to your computer and use it in GitHub Desktop.
var $ = require('jQuery');
var _ = require('_');
var React = require('react');
var FinancingApplicationView = require('financing/views/FinancingApplicationView.react.jsx');
var FinancingConstants = require('financing/FinancingConstants.js');
var FinancingApplicationData = require('financing/models/FinancingApplicationData.js');
var FinancingApplicant = require('financing/models/FinancingApplicant.js');
var activeApplicant = new FinancingApplicant();
var applicationData = new FinancingApplicationData();
var applicantIndex = 0;
var primaryApplicant = activeApplicant;
var secondaryApplicant = new FinancingApplicant();
var section = FinancingConstants.WELCOME;
var defaultSubjectProps = {
activeApplicant: activeApplicant,
appModel: applicationData, // TODO rename prop
applicantIndex: applicantIndex,
primaryApplicant: primaryApplicant,
secondaryApplicant: secondaryApplicant,
section: section,
// optional props.
review: undefined,
secondaryApplicant: undefined,
sectionModelIndex: undefined
};
var buildSubject = function(props) {
return (
<FinancingApplicationView
// required props.
activeApplicant={props.activeApplicant}
appModel={props.appModel}
applicantIndex={props.applicantIndex}
primaryApplicant={props.primaryApplicant}
secondaryApplicant={props.secondaryApplicant}
section={props.section}
// optional props.
review={props.review}
secondaryApplicant={props.secondaryApplicant}
sectionModelIndex={props.sectionModelIndex}
/>
);
};
describe('FinancingApplicationView', function() {
describe('#getNextURLPath', function() {
it('returns the next url path', function() {
var testCases = [
{
path: '/financing/welcome',
nextPath: 'financing/applicant/0/personal_details',
subjectProps: defaultSubjectProps
}
];
testCases.forEach(function(testCase) {
var subject = buildSubject(testCase.subjectProps);
assert.isEqual(subject.getNextURLPath(), testCase.nextPath);
});
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment