-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RND-623] initial matchup to MetaEd api-schema plugin #300
Changes from all commits
8563ce6
154d3d8
5ae9a2f
acc8db7
3b12a18
fc23e27
cf482e5
613e3fd
e4f3722
86c1c32
e650075
393e134
6d27ad7
969cecb
9372f40
6bb6b4a
ef52527
3f3c2c5
dee7df7
73c049b
5b0d654
176e9e2
010d3e2
8dd5b00
7f77375
f91751f
a621571
46e8d36
fe2104b
b024216
19018f5
04884e1
ce4f21c
32785eb
ca07400
4a3cd53
b942c70
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,12 @@ export const setupConfigForIntegration = async () => { | |
return; | ||
} | ||
|
||
const path = join(process.cwd(), '.env'); | ||
// First look for .env file paired with this Config.ts file | ||
let path = join(__dirname, '.env'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. allow for different .envs in each backend rather than force one big .env at root There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I really like this |
||
|
||
if (!existsSync(path)) { | ||
path = join(process.cwd(), '.env'); | ||
} | ||
|
||
if (!existsSync(path)) { | ||
// eslint-disable-next-line no-console | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,8 @@ import { | |
MeadowlarkId, | ||
TraceId, | ||
UpsertResult, | ||
MetaEdResourceName, | ||
MetaEdProjectName, | ||
} from '@edfi/meadowlark-core'; | ||
import { Collection, MongoClient } from 'mongodb'; | ||
import { MeadowlarkDocument } from '../../src/model/MeadowlarkDocument'; | ||
|
@@ -53,7 +55,7 @@ describe('given the delete of a non-existent document', () => { | |
|
||
const resourceInfo: ResourceInfo = { | ||
...newResourceInfo(), | ||
resourceName: 'School', | ||
resourceName: 'School' as MetaEdResourceName, | ||
}; | ||
|
||
beforeAll(async () => { | ||
|
@@ -84,11 +86,11 @@ describe('given the delete of an existing document', () => { | |
|
||
const resourceInfo: ResourceInfo = { | ||
...newResourceInfo(), | ||
resourceName: 'School', | ||
resourceName: 'School' as MetaEdResourceName, | ||
}; | ||
const documentInfo: DocumentInfo = { | ||
...newDocumentInfo(), | ||
documentIdentity: { natural: 'delete2' }, | ||
documentIdentity: [{ natural: 'delete2' }], | ||
}; | ||
|
||
beforeAll(async () => { | ||
|
@@ -135,12 +137,12 @@ describe('given the delete of a document referenced by an existing document with | |
|
||
const referencedResourceInfo: ResourceInfo = { | ||
...newResourceInfo(), | ||
resourceName: 'School', | ||
resourceName: 'School' as MetaEdResourceName, | ||
}; | ||
|
||
const referencedDocumentInfo: DocumentInfo = { | ||
...newDocumentInfo(), | ||
documentIdentity: { natural: 'delete5' }, | ||
documentIdentity: [{ natural: 'delete5' }], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Document identity structure changed to enforce ordering |
||
}; | ||
const referencedMeadowlarkId = meadowlarkIdForDocumentIdentity( | ||
referencedResourceInfo, | ||
|
@@ -156,11 +158,11 @@ describe('given the delete of a document referenced by an existing document with | |
|
||
const documentWithReferencesResourceInfo: ResourceInfo = { | ||
...newResourceInfo(), | ||
resourceName: 'AcademicWeek', | ||
resourceName: 'AcademicWeek' as MetaEdResourceName, | ||
}; | ||
const documentWithReferencesInfo: DocumentInfo = { | ||
...newDocumentInfo(), | ||
documentIdentity: { natural: 'delete6' }, | ||
documentIdentity: [{ natural: 'delete6' }], | ||
documentReferences: [validReference], | ||
}; | ||
const documentWithReferencesMeadowlarkId = meadowlarkIdForDocumentIdentity( | ||
|
@@ -218,7 +220,7 @@ describe('given the delete of a document referenced by an existing document with | |
it('should still have the referenced document in the db', async () => { | ||
const collection: Collection<MeadowlarkDocument> = getDocumentCollection(client); | ||
const result: any = await collection.findOne({ _id: referencedMeadowlarkId }); | ||
expect(result.documentIdentity.natural).toBe('delete5'); | ||
expect(result.documentIdentity[0].natural).toBe('delete5'); | ||
}); | ||
}); | ||
|
||
|
@@ -229,12 +231,12 @@ describe('given an delete of a document with an outbound reference only, with va | |
|
||
const referencedResourceInfo: ResourceInfo = { | ||
...newResourceInfo(), | ||
resourceName: 'AcademicWeek', | ||
resourceName: 'AcademicWeek' as MetaEdResourceName, | ||
}; | ||
|
||
const referencedDocumentInfo: DocumentInfo = { | ||
...newDocumentInfo(), | ||
documentIdentity: { natural: 'delete15' }, | ||
documentIdentity: [{ natural: 'delete15' }], | ||
}; | ||
const referencedMeadowlarkId = meadowlarkIdForDocumentIdentity( | ||
referencedResourceInfo, | ||
|
@@ -250,11 +252,11 @@ describe('given an delete of a document with an outbound reference only, with va | |
|
||
const documentWithReferencesResourceInfo: ResourceInfo = { | ||
...newResourceInfo(), | ||
resourceName: 'School', | ||
resourceName: 'School' as MetaEdResourceName, | ||
}; | ||
const documentWithReferencesInfo: DocumentInfo = { | ||
...newDocumentInfo(), | ||
documentIdentity: { natural: 'delete16' }, | ||
documentIdentity: [{ natural: 'delete16' }], | ||
documentReferences: [validReference], | ||
}; | ||
const documentWithReferencesMeadowlarkId = meadowlarkIdForDocumentIdentity( | ||
|
@@ -323,11 +325,11 @@ describe('given the delete of a document referenced by an existing document with | |
|
||
const referencedResourceInfo: ResourceInfo = { | ||
...newResourceInfo(), | ||
resourceName: 'School', | ||
resourceName: 'School' as MetaEdResourceName, | ||
}; | ||
const referencedDocumentInfo: DocumentInfo = { | ||
...newDocumentInfo(), | ||
documentIdentity: { natural: 'delete5' }, | ||
documentIdentity: [{ natural: 'delete5' }], | ||
}; | ||
const referencedMeadowlarkId = meadowlarkIdForDocumentIdentity( | ||
referencedResourceInfo, | ||
|
@@ -343,11 +345,11 @@ describe('given the delete of a document referenced by an existing document with | |
|
||
const documentWithReferencesResourceInfo: ResourceInfo = { | ||
...newResourceInfo(), | ||
resourceName: 'AcademicWeek', | ||
resourceName: 'AcademicWeek' as MetaEdResourceName, | ||
}; | ||
const documentWithReferencesInfo: DocumentInfo = { | ||
...newDocumentInfo(), | ||
documentIdentity: { natural: 'delete6' }, | ||
documentIdentity: [{ natural: 'delete6' }], | ||
documentReferences: [validReference], | ||
}; | ||
const documentWithReferencesMeadowlarkId = meadowlarkIdForDocumentIdentity( | ||
|
@@ -416,20 +418,20 @@ describe('given the delete of a subclass document referenced by an existing docu | |
|
||
const referencedResourceInfo: ResourceInfo = { | ||
...newResourceInfo(), | ||
resourceName: 'School', | ||
projectName: 'Ed-Fi', | ||
resourceName: 'School' as MetaEdResourceName, | ||
projectName: 'Ed-Fi' as MetaEdProjectName, | ||
}; | ||
|
||
const superclassInfo: SuperclassInfo = { | ||
...newSuperclassInfo(), | ||
documentIdentity: { educationOrganizationId: '123' }, | ||
resourceName: 'EducationOrganization', | ||
projectName: 'Ed-Fi', | ||
documentIdentity: [{ educationOrganizationId: '123' }], | ||
resourceName: 'EducationOrganization' as MetaEdResourceName, | ||
projectName: 'Ed-Fi' as MetaEdProjectName, | ||
}; | ||
|
||
const referencedDocumentInfo: DocumentInfo = { | ||
...newDocumentInfo(), | ||
documentIdentity: { schoolId: '123' }, | ||
documentIdentity: [{ schoolId: '123' }], | ||
superclassInfo, | ||
}; | ||
const referencedMeadowlarkId = meadowlarkIdForDocumentIdentity( | ||
|
@@ -446,11 +448,11 @@ describe('given the delete of a subclass document referenced by an existing docu | |
|
||
const documentWithReferenceResourceInfo: ResourceInfo = { | ||
...newResourceInfo(), | ||
resourceName: 'AcademicWeek', | ||
resourceName: 'AcademicWeek' as MetaEdResourceName, | ||
}; | ||
const documentWithReferenceDocumentInfo: DocumentInfo = { | ||
...newDocumentInfo(), | ||
documentIdentity: { week: 'delete6' }, | ||
documentIdentity: [{ week: 'delete6' }], | ||
documentReferences: [referenceAsSuperclass], | ||
}; | ||
const documentWithReferencesMeadowlarkId = meadowlarkIdForDocumentIdentity( | ||
|
@@ -508,6 +510,6 @@ describe('given the delete of a subclass document referenced by an existing docu | |
it('should still have the referenced document in the db', async () => { | ||
const collection: Collection<MeadowlarkDocument> = getDocumentCollection(client); | ||
const result: any = await collection.findOne({ _id: referencedMeadowlarkId }); | ||
expect(result.documentIdentity.schoolId).toBe('123'); | ||
expect(result.documentIdentity[0].schoolId).toBe('123'); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More branded strings to avoid getting them confused