Skip to content

Commit

Permalink
Merge pull request #7 from ATOR-Development/external_reverts
Browse files Browse the repository at this point in the history
Graceful handling on external errors when validator is interacting with blockchains
  • Loading branch information
kanshi authored Oct 18, 2023
2 parents 493fe75 + dae408c commit e8c8a66
Show file tree
Hide file tree
Showing 36 changed files with 2,000 additions and 661 deletions.
14 changes: 4 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,20 +124,14 @@ $ npm run start

# watch mode
$ npm run start:dev

# production mode
$ npm run start:prod
```

### Testing

```bash
# unit tests
$ npm run test
# dev testing
$ npm test -- --watch

# e2e tests
$ npm run test:e2e

# test coverage
$ npm run test:cov
# unit tests
$ npm test
```
21 changes: 19 additions & 2 deletions src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ import { ValidationModule } from './validation/validation.module'
import { MongooseModule } from '@nestjs/mongoose'
import { ConfigModule, ConfigService } from '@nestjs/config'
import { VerificationModule } from './verification/verification.module'
import { EventsModule } from './events/events.module';
import { DistributionModule } from './distribution/distribution.module';
import { EventsModule } from './events/events.module'
import { DistributionModule } from './distribution/distribution.module'
import { BullModule } from '@nestjs/bullmq'
import { ChecksModule } from './checks/checks.module'

@Module({
imports: [
Expand All @@ -20,9 +22,24 @@ import { DistributionModule } from './distribution/distribution.module';
uri: config.get<string>('MONGO_URI', { infer: true }),
}),
}),
BullModule.forRootAsync({
inject: [ConfigService],
useFactory: (
config: ConfigService<{
REDIS_HOSTNAME: string
REDIS_PORT: number
}>,
) => ({
connection: {
host: config.get<string>('REDIS_HOSTNAME', { infer: true }),
port: config.get<number>('REDIS_PORT', { infer: true }),
},
}),
}),
VerificationModule,
EventsModule,
DistributionModule,
ChecksModule,
],
controllers: [AppController],
providers: [AppService],
Expand Down
34 changes: 34 additions & 0 deletions src/checks/balances.service.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { Test, TestingModule } from '@nestjs/testing'
import { BullModule } from '@nestjs/bullmq'
import { ConfigModule } from '@nestjs/config'
import { MongooseModule } from '@nestjs/mongoose'
import { BalancesService } from './balances.service'
import { BalancesData, BalancesDataSchema } from './schemas/balances-data'

describe('BalancesService', () => {
let service: BalancesService

beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
imports: [
ConfigModule.forRoot(),
MongooseModule.forRoot(
'mongodb://localhost/validATOR-balances-service-tests',
),
MongooseModule.forFeature([
{
name: BalancesData.name,
schema: BalancesDataSchema,
},
]),
],
providers: [BalancesService],
}).compile()

service = module.get<BalancesService>(BalancesService)
})

it('should be defined', () => {
expect(service).toBeDefined()
})
})
Loading

0 comments on commit e8c8a66

Please sign in to comment.