-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding SQLite db to authz, updating persitence directory structure, s…
…tarting to wire up crud for entities
- Loading branch information
1 parent
ca16216
commit 8fe45dc
Showing
22 changed files
with
480 additions
and
50 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 |
---|---|---|
|
@@ -54,4 +54,7 @@ Thumbs.db | |
.env.production | ||
.env.test | ||
|
||
/rego-build | ||
/rego-build | ||
|
||
*.sqlite | ||
*.sqlite-journal |
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 +1,5 @@ | ||
NODE_ENV=development | ||
|
||
PORT=3010 | ||
|
||
ENGINE_DATABASE_URL="file:./engine-core.sqlite" |
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,2 +1,5 @@ | ||
# IMPORTANT: The variables defined here will override other variables. | ||
# See `./apps/authz/jest.setup.ts`. | ||
NODE_ENV=test | ||
|
||
ENGINE_DATABASE_URL="file:./engine-core-test.sqlite" |
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
50 changes: 50 additions & 0 deletions
50
...authz/src/app/persistence/repository/__test__/integration/organization.repository.spec.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,50 @@ | ||
import { load } from '@app/authz/app/app.config' | ||
import { OrganizationRepository } from '@app/authz/app/persistence/repository/organization.repository' | ||
import { PersistenceModule } from '@app/authz/shared/module/persistence/persistence.module' | ||
import { TestPrismaService } from '@app/authz/shared/module/persistence/service/test-prisma.service' | ||
import { Alg } from '@narval/authz-shared' | ||
import { ConfigModule } from '@nestjs/config' | ||
import { Test, TestingModule } from '@nestjs/testing' | ||
|
||
describe(OrganizationRepository.name, () => { | ||
let module: TestingModule | ||
let repository: OrganizationRepository | ||
let testPrismaService: TestPrismaService | ||
|
||
beforeEach(async () => { | ||
module = await Test.createTestingModule({ | ||
imports: [ | ||
ConfigModule.forRoot({ | ||
load: [load], | ||
isGlobal: true | ||
}), | ||
PersistenceModule | ||
], | ||
providers: [OrganizationRepository] | ||
}).compile() | ||
|
||
testPrismaService = module.get<TestPrismaService>(TestPrismaService) | ||
repository = module.get<OrganizationRepository>(OrganizationRepository) | ||
}) | ||
|
||
afterEach(async () => { | ||
await testPrismaService.truncateAll() | ||
await module.close() | ||
}) | ||
|
||
describe('create', () => { | ||
it('creates a new organization', async () => { | ||
await repository.createOrganization('test-org-uid', 'test-user-uid', { | ||
alg: Alg.ES256K, | ||
pubKey: 'test-public-key' | ||
}) | ||
|
||
const org = await testPrismaService.getClient().organization.findFirst({ | ||
where: { | ||
uid: 'test-org-uid' | ||
} | ||
}) | ||
expect(org).toEqual({ uid: 'test-org-uid' }) | ||
}) | ||
}) | ||
}) |
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.