Skip to content

Commit

Permalink
Fix tests in pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
Christopher Graney-Ward committed Jun 16, 2024
1 parent 8d57dc6 commit 63227cd
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/services/api/api.contoller.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { AuthModule } from '../auth/auth.module';
import { MockAuthGuard, MockUserDetailsInterceptor, UserDetailsInterceptor } from './utils';
import { HiveModule } from '../../repositories/hive/hive.module';
import { EmailModule } from '../email/email.module';
import * as crypto from 'crypto';

describe('ApiController', () => {
let app: INestApplication;
Expand All @@ -36,6 +37,9 @@ describe('ApiController', () => {
mongod = await MongoMemoryServer.create();
const uri = mongod.getUri();

process.env.JWT_PRIVATE_KEY = crypto.randomBytes(64).toString('hex');
process.env.ENVIRONMENT = 'local'

@Module({
imports: [
ConfigModule,
Expand Down Expand Up @@ -68,7 +72,7 @@ describe('ApiController', () => {
HiveModule,
ApiModule,
JwtModule.register({
secret: 'ac746c4dc9faf199d7fec029f1e8646c08da3698d9c95b931a1df2ceb666e336dbdacf46763a89777206cf48fc43be42cbe0f988e4bd4a10e7610173d29310ea987d93bae49f6391b91a5338cffbf2389797d7217903b2db1cbf983632f64e088fb515537262d2475589370fc1f5aa7820c34f0f5523fb88f75dace392d22caf',
secretOrPrivateKey: process.env.JWT_PRIVATE_KEY,
signOptions: { expiresIn: '30d' },
}),
LinkedAccountModule
Expand Down
1 change: 1 addition & 0 deletions src/services/auth/auth.controller.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ describe('AuthController', () => {
const uri: string = mongod.getUri()

process.env.JWT_PRIVATE_KEY = crypto.randomBytes(64).toString('hex');
process.env.ENVIRONMENT = 'local'

@Module({
imports: [
Expand Down
4 changes: 4 additions & 0 deletions src/services/auth/auth.middleware.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ describe('AuthMiddleware', () => {
const key = new Ed25519Provider(seedBuf)
const did = new DID({ provider: key, resolver: KeyResolver.getResolver() })

beforeAll(() => {
process.env.ENVIRONMENT = 'local'
})

beforeEach(() => {
authMiddleware = new AuthMiddleware();
});
Expand Down
3 changes: 2 additions & 1 deletion src/services/uploader/uploading.controller.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ describe('UploadingController', () => {
const uri = mongod.getUri();

process.env.JWT_PRIVATE_KEY = crypto.randomBytes(64).toString('hex');
process.env.ENVIRONMENT = 'local'

@Module({
imports: [
Expand All @@ -56,7 +57,7 @@ describe('UploadingController', () => {
IpfsModule,
PublishingModule,
JwtModule.register({
secretOrPrivateKey: 'ac746c4dc9faf199d7fec029f1e8646c08da3698d9c95b931a1df2ceb666e336dbdacf46763a89777206cf48fc43be42cbe0f988e4bd4a10e7610173d29310ea987d93bae49f6391b91a5338cffbf2389797d7217903b2db1cbf983632f64e088fb515537262d2475589370fc1f5aa7820c34f0f5523fb88f75dace392d22caf',
secretOrPrivateKey: process.env.JWT_PRIVATE_KEY,
signOptions: { expiresIn: '30d' },
}),
UploadingModule
Expand Down

0 comments on commit 63227cd

Please sign in to comment.