diff options
| author | jw255 | 2018-04-10 23:30:51 +0100 |
|---|---|---|
| committer | jw255 | 2018-04-10 23:30:51 +0100 |
| commit | f7220be4e1b80cdba0fbaf41f7382cbf18561e2b (patch) | |
| tree | efb137a8db4649798e9eae7ad9de4cae2f9b3429 /test/test-db.ts | |
| parent | progress on testing (diff) | |
| download | medicine-f7220be4e1b80cdba0fbaf41f7382cbf18561e2b.tar.gz medicine-f7220be4e1b80cdba0fbaf41f7382cbf18561e2b.zip | |
sth works maybe
Diffstat (limited to 'test/test-db.ts')
| -rw-r--r-- | test/test-db.ts | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/test-db.ts b/test/test-db.ts index f20608a..fa62ad7 100644 --- a/test/test-db.ts +++ b/test/test-db.ts @@ -1,3 +1,4 @@ +import { default as Project } from '../src/db/model/Project'; import { default as User } from '../src/db/model/User'; import { default as UserGroup } from '../src/db/model/UserGroup'; @@ -29,6 +30,13 @@ export interface Credentials { usergroups: UserGroup[]; } +export interface Projec { + name: string; + contributors: Credentials[]; + creationDate: Date; + lastActivity: Date; +} + export const addUser: (database?: Database, admin?: boolean) => Promise<Credentials> = async( database?: Database, admin?: boolean @@ -55,3 +63,18 @@ export const addUser: (database?: Database, admin?: boolean) => await new User(mockUser).save(); return mockUser; }; + +export const addProjec: (database: Database, user: Credentials) => + Promise<Projec> = async( + database: Database, user: Credentials +): Promise<Projec> => { + const mockProject: Projec = { + name: 'mocky', + contributors: [user], + creationDate: new Date(), + lastActivity: new Date() + }; + + await new Project(mockProject).save(); + return mockProject; +}; |
