Skip to content

Commit

Permalink
Merge pull request #398 from flexion/sprint-47.5
Browse files Browse the repository at this point in the history
Sprint 47.5 Umzug Migration Bug Fix
  • Loading branch information
mmarcotte authored Sep 8, 2020
2 parents 1140498 + c96da15 commit 9bf25c9
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 2 deletions.
4 changes: 4 additions & 0 deletions docs/entities/Case.md
Original file line number Diff line number Diff line change
Expand Up @@ -1387,6 +1387,7 @@
presence: "optional"
allow:
- ""
- null
otherwise:
type: "any"
flags:
Expand All @@ -1397,6 +1398,7 @@
presence: "optional"
allow:
- ""
- null
filingDate:
type: "date"
flags:
Expand Down Expand Up @@ -5505,6 +5507,7 @@
presence: "optional"
allow:
- ""
- null
otherwise:
type: "any"
flags:
Expand All @@ -5515,6 +5518,7 @@
presence: "optional"
allow:
- ""
- null
filingDate:
type: "date"
flags:
Expand Down
2 changes: 2 additions & 0 deletions docs/entities/CaseInternal.md
Original file line number Diff line number Diff line change
Expand Up @@ -1394,6 +1394,7 @@
presence: "optional"
allow:
- ""
- null
otherwise:
type: "any"
flags:
Expand All @@ -1404,6 +1405,7 @@
presence: "optional"
allow:
- ""
- null
filingDate:
type: "date"
flags:
Expand Down
2 changes: 2 additions & 0 deletions docs/entities/Document.md
Original file line number Diff line number Diff line change
Expand Up @@ -1293,6 +1293,7 @@
presence: "optional"
allow:
- ""
- null
otherwise:
type: "any"
flags:
Expand All @@ -1303,6 +1304,7 @@
presence: "optional"
allow:
- ""
- null
filingDate:
type: "date"
flags:
Expand Down
4 changes: 2 additions & 2 deletions shared/src/business/entities/Document.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ Document.VALIDATION_RULES = joi.object().keys({
...EXTERNAL_DOCUMENT_TYPES,
...INTERNAL_DOCUMENT_TYPES,
),
otherwise: joi.allow('').optional(),
otherwise: joi.allow('', null).optional(),
then: joi.when('documentType', {
is: JoiValidationConstants.STRING.valid(
...AUTOGENERATED_EXTERNAL_DOCUMENT_TYPES,
Expand All @@ -271,7 +271,7 @@ Document.VALIDATION_RULES = joi.object().keys({
otherwise: joi.required(),
then: joi.when('isAutoGenerated', {
is: false,
otherwise: joi.allow('').optional(),
otherwise: joi.allow('', null).optional(),
then: joi.required(),
}),
}),
Expand Down
89 changes: 89 additions & 0 deletions shared/src/business/entities/Document.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,95 @@ describe('Document entity', () => {
expect(error).toBeDefined();
});

it('should not throw an error on valid documents', () => {
let error;
try {
new Document(
{
createdAt: '2019-03-27T00:00:00.000-04:00',
documentId: '0ed63e9d-8fb5-4a55-b268-a7cd10d7cbcd',
documentTitle:
'ORDER THAT PETR. BY 4/18/19 FILE, UNDER SEAL, A RESPONSE TO THIS ORDER AS STATED HEREIN.',
documentType: 'Order',
entityName: 'Document',
eventCode: 'O',
filedBy: null,
filingDate: '2019-03-27T00:00:00.000-04:00',
isDraft: false,
isFileAttached: true,
isLegacy: true,
isLegacySealed: false,
isSealed: false,
judge: 'Mock Judge',
pending: false,
processingStatus: 'pending',
receivedAt: '2020-08-21T20:07:44.018Z',
servedAt: '2019-03-28T00:00:00.000-04:00',
servedParties: [
{
name: 'Bernard Lowe',
},
{
name: 'IRS',
role: 'irsSuperuser',
},
],
signedAt: 'Not in Blackstone',
signedByUserId: 'a11077ed-c01d-4add-ab1e-da7aba5eda7a',
signedJudgeName: 'Mock Signed Judge',
userId: 'a11077ed-c01d-4add-ab1e-da7aba5eda7a',
},
{ applicationContext },
).validate();
} catch (err) {
error = err;
}
expect(error).toBeUndefined();

try {
new Document(
{
createdAt: '2019-03-27T00:00:00.000-04:00',
documentId: '0ed63e9d-8fb5-4a55-b268-a7cd10d7cbcd',
documentTitle:
'ORDER THAT PETR. BY 4/18/19 FILE, UNDER SEAL, A RESPONSE TO THIS ORDER AS STATED HEREIN.',
documentType: 'Order',
entityName: 'Document',
eventCode: 'O',
filedBy: '',
filingDate: '2019-03-27T00:00:00.000-04:00',
isDraft: false,
isFileAttached: true,
isLegacy: true,
isLegacySealed: false,
isSealed: false,
judge: 'Mock Judge',
pending: false,
processingStatus: 'pending',
receivedAt: '2020-08-21T20:07:44.018Z',
servedAt: '2019-03-28T00:00:00.000-04:00',
servedParties: [
{
name: 'Bernard Lowe',
},
{
name: 'IRS',
role: 'irsSuperuser',
},
],
signedAt: 'Not in Blackstone',
signedByUserId: 'a11077ed-c01d-4add-ab1e-da7aba5eda7a',
signedJudgeName: 'Mock Signed Judge',
userId: 'a11077ed-c01d-4add-ab1e-da7aba5eda7a',
},
{ applicationContext },
).validate();
} catch (err) {
error = err;
}
expect(error).toBeUndefined();
});

it('should correctly validate with a secondaryDate', () => {
const document = new Document(
{
Expand Down

0 comments on commit 9bf25c9

Please sign in to comment.