-
Notifications
You must be signed in to change notification settings - Fork 6
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 #58 from osher-sade/reality-integration-tests
Reality integration tests
- Loading branch information
Showing
20 changed files
with
279 additions
and
71 deletions.
There are no files selected for viewing
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,13 +1,12 @@ | ||
module.exports = { | ||
preset: 'ts-jest', | ||
setupTestFrameworkScriptFile: './jest.setup.js', | ||
testEnvironment: 'node', | ||
clearMocks : true, | ||
moduleFileExtensions: [ | ||
"ts", | ||
"js", | ||
], | ||
preset: 'ts-jest', | ||
testEnvironment: 'node', | ||
testMatch: [ | ||
"**/*.test.ts" | ||
], | ||
}; | ||
}; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { getModelCreator, RepositoryModel } from '@enigmatis/mongo-driver'; | ||
import { Schema } from 'mongoose'; | ||
|
||
export interface Author extends RepositoryModel { | ||
testId: string; | ||
firstName: string; | ||
lastName: string; | ||
} | ||
|
||
export const authorSchema: Schema = new Schema({ | ||
testId: String, | ||
firstName: String, | ||
lastName: String, | ||
}); | ||
|
||
export const AuthorModelPerReality = getModelCreator<Author>('author', authorSchema); |
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,20 +1,24 @@ | ||
import { getModelCreator, RepositoryModel } from '@enigmatis/mongo-driver'; | ||
import { getModelCreator, RepositoryModel, SchemaCreator } from '@enigmatis/mongo-driver'; | ||
import { Schema } from 'mongoose'; | ||
import { Author } from './author-model'; | ||
|
||
export interface Book extends RepositoryModel { | ||
testId: string; | ||
title: string; | ||
author: string; | ||
otherBook: Book; | ||
author: Author; | ||
dataVersion: number; | ||
} | ||
|
||
export const bookSchema: Schema = new Schema({ | ||
testId: String, | ||
title: String, | ||
author: String, | ||
otherBook: Object, | ||
dataVersion: Number, | ||
}); | ||
export const bookSchema: SchemaCreator = refNameCreator => { | ||
return new Schema({ | ||
testId: String, | ||
title: String, | ||
author: { | ||
type: Schema.Types.ObjectId, | ||
ref: refNameCreator('author'), | ||
}, | ||
dataVersion: Number, | ||
}); | ||
}; | ||
|
||
export const BookModelPerReality = getModelCreator<Book>('book', bookSchema); |
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
8 changes: 8 additions & 0 deletions
8
test/integration-tests/test-server/schema/definitions/author.ts
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { RepositoryEntity } from '../../../../../src/main'; | ||
|
||
export interface Author extends RepositoryEntity { | ||
testId: string; | ||
id: string; | ||
firstName: string; | ||
lastName: string; | ||
} |
4 changes: 2 additions & 2 deletions
4
test/integration-tests/test-server/schema/definitions/book.ts
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,9 +1,9 @@ | ||
import { RepositoryEntity } from '../../../../../src/main'; | ||
import { Author } from './author'; | ||
|
||
export interface Book extends RepositoryEntity { | ||
testId: string; | ||
id: string; | ||
title: string; | ||
author: string; | ||
otherBook?: Book; | ||
author: Author; | ||
} |
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
10 changes: 10 additions & 0 deletions
10
test/integration-tests/test-server/schema/types/input/author-input.ts
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
export const AuthorInput = `input AuthorInput { | ||
id: ID!, | ||
testId: String!, | ||
firstName: String, | ||
lastName: String | ||
}, | ||
input UpdateAuthorInput { | ||
firstName: String, | ||
lastName: String | ||
}`; |
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
9 changes: 9 additions & 0 deletions
9
test/integration-tests/test-server/schema/types/output/author.ts
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export const Author = `type Author implements CommonEntity { | ||
id: ID! | ||
firstName: String, | ||
lastName: String, | ||
creationDate: Date, | ||
lastUpdateDate: Date, | ||
dataVersion: Int!, | ||
realityId: Int! | ||
}`; |
5 changes: 2 additions & 3 deletions
5
test/integration-tests/test-server/schema/types/output/book.ts
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,11 +1,10 @@ | ||
export const Book = `type Book implements CommonEntity { | ||
testId: String, | ||
id: ID!, | ||
title: String, | ||
author: Author, | ||
creationDate: Date, | ||
lastUpdateDate: Date, | ||
dataVersion: Int!, | ||
title: String, | ||
author: String, | ||
otherBook: ID, | ||
realityId: Int! | ||
}`; |
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
Oops, something went wrong.