This repository has been archived by the owner on Sep 19, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1778 from 18F/jf-3845-85-test-scenarios
[EN-3845] Create SF85 test scenarios
- Loading branch information
Showing
14 changed files
with
12,659 additions
and
54 deletions.
There are no files selected for viewing
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,130 +1,149 @@ | ||
import store from 'services/store' | ||
import { validateModel } from 'models/validate' | ||
import offense from 'models/offense' | ||
import { | ||
requireLegalOffenseInvolvements, | ||
requireLegalOffenseSentenced, | ||
requireLegalOffenseIncarcerated, | ||
} from 'helpers/branches' | ||
|
||
export const validateOffense = data => validateModel(data, offense) === true | ||
const options = formType => ( | ||
{ | ||
requireLegalOffenseInvolvements: requireLegalOffenseInvolvements(formType), | ||
requireLegalOffenseSentenced: requireLegalOffenseSentenced(formType), | ||
requireLegalOffenseIncarcerated: requireLegalOffenseIncarcerated(formType), | ||
} | ||
) | ||
|
||
export const validateOffense = (data, formType) => ( | ||
validateModel(data, offense, options(formType)) === true | ||
) | ||
|
||
export default class OffenseValidator { | ||
constructor(data = {}) { | ||
const state = store.getState() | ||
const { formType } = state.application.Settings | ||
this.data = data | ||
this.formType = formType | ||
} | ||
|
||
validDate() { | ||
return validateModel(this.data, { | ||
Date: offense.Date, | ||
}) === true | ||
}, options(this.formType)) === true | ||
} | ||
|
||
validDescription() { | ||
return validateModel(this.data, { | ||
Description: offense.Description, | ||
}) === true | ||
}, options(this.formType)) === true | ||
} | ||
|
||
validViolence() { | ||
return validateModel(this.data, { | ||
InvolvedViolence: offense.InvolvedViolence, | ||
}) === true | ||
}, options(this.formType)) === true | ||
} | ||
|
||
validFirearms() { | ||
return validateModel(this.data, { | ||
InvolvedFirearms: offense.InvolvedFirearms, | ||
}) === true | ||
}, options(this.formType)) === true | ||
} | ||
|
||
validSubstances() { | ||
return validateModel(this.data, { | ||
InvolvedSubstances: offense.InvolvedSubstances, | ||
}) === true | ||
}, options(this.formType)) === true | ||
} | ||
|
||
validAddress() { | ||
return validateModel(this.data, { | ||
Address: offense.Address, | ||
}) === true | ||
}, options(this.formType)) === true | ||
} | ||
|
||
validCited() { | ||
return validateModel(this.data, { | ||
WasCited: offense.WasCited, | ||
}) === true | ||
}, options(this.formType)) === true | ||
} | ||
|
||
validCitedBy() { | ||
return validateModel(this.data, { | ||
CitedBy: offense.CitedBy, | ||
}) === true | ||
}, options(this.formType)) === true | ||
} | ||
|
||
validAgencyAddress() { | ||
return validateModel(this.data, { | ||
AgencyAddress: offense.AgencyAddress, | ||
}) === true | ||
}, options(this.formType)) === true | ||
} | ||
|
||
validCharged() { | ||
return validateModel(this.data, { | ||
WasCharged: offense.WasCharged, | ||
}) === true | ||
}, options(this.formType)) === true | ||
} | ||
|
||
validExplanation() { | ||
return validateModel(this.data, { | ||
Explanation: offense.Explanation, | ||
}) === true | ||
}, options(this.formType)) === true | ||
} | ||
|
||
validCourtName() { | ||
return validateModel(this.data, { | ||
CourtName: offense.CourtName, | ||
}) === true | ||
}, options(this.formType)) === true | ||
} | ||
|
||
validCourtAddress() { | ||
return validateModel(this.data, { | ||
CourtAddress: offense.CourtAddress, | ||
}) === true | ||
}, options(this.formType)) === true | ||
} | ||
|
||
validChargeType() { | ||
return validateModel(this.data, { | ||
ChargeType: offense.ChargeType, | ||
}) === true | ||
}, options(this.formType)) === true | ||
} | ||
|
||
validCourtCharge() { | ||
return validateModel(this.data, { | ||
CourtCharge: offense.CourtCharge, | ||
}) === true | ||
}, options(this.formType)) === true | ||
} | ||
|
||
validCourtOutcome() { | ||
return validateModel(this.data, { | ||
CourtOutcome: offense.CourtOutcome, | ||
}) === true | ||
}, options(this.formType)) === true | ||
} | ||
|
||
validCourtDate() { | ||
return validateModel(this.data, { | ||
CourtDate: offense.CourtDate, | ||
}) === true | ||
}, options(this.formType)) === true | ||
} | ||
|
||
validSentenced() { | ||
return validateModel(this.data, { | ||
WasSentenced: offense.WasSentenced, | ||
Sentence: offense.Sentence, | ||
}) === true | ||
}, options(this.formType)) === true | ||
} | ||
|
||
validAwaitingTrial() { | ||
return validateModel(this.data, { | ||
AwaitingTrial: offense.AwaitingTrial, | ||
AwaitingTrialExplanation: offense.AwaitingTrialExplanation, | ||
}) === true | ||
}, options(this.formType)) === true | ||
} | ||
|
||
isValid() { | ||
return validateOffense(this.data) | ||
return validateOffense(this.data, this.formType) | ||
} | ||
} |
Oops, something went wrong.