Skip to content

Commit 2f38035

Browse files
committed
fix: basic test fixed
1 parent b80469d commit 2f38035

File tree

3 files changed

+15
-10
lines changed

3 files changed

+15
-10
lines changed
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { Module } from '@nestjs/common';
2-
import { FileModificationService } from './unraid-file-modifier.service';
2+
3+
import { UnraidFileModificationService } from './unraid-file-modifier.service';
34

45
@Module({
5-
providers: [FileModificationService]
6+
providers: [UnraidFileModificationService],
67
})
78
export class UnraidFileModifierModule {}

api/src/unraid-api/unraid-file-modifier/unraid-file-modifier.service.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ export interface FileModification {
1919

2020
// Step 2: Create a FileModificationService
2121
@Injectable()
22-
export class FileModificationService implements OnModuleInit, OnModuleDestroy {
23-
private readonly logger = new Logger(FileModificationService.name);
22+
export class UnraidFileModificationService implements OnModuleInit, OnModuleDestroy {
23+
private readonly logger = new Logger(UnraidFileModificationService.name);
2424
private history: FileModification[] = []; // Keeps track of applied modifications
2525

2626
async onModuleInit() {
@@ -71,12 +71,16 @@ export class FileModificationService implements OnModuleInit, OnModuleDestroy {
7171
try {
7272
const shouldApplyWithReason = await modification.shouldApply();
7373
if (shouldApplyWithReason.shouldApply) {
74-
this.logger.log(`Applying modification: ${modification.id} - ${shouldApplyWithReason.reason}`);
74+
this.logger.log(
75+
`Applying modification: ${modification.id} - ${shouldApplyWithReason.reason}`
76+
);
7577
await modification.apply();
7678
this.history.push(modification); // Store modification in history
7779
this.logger.log(`Modification applied successfully: ${modification.id}`);
7880
} else {
79-
this.logger.log(`Skipping modification: ${modification.id} - ${shouldApplyWithReason.reason}`);
81+
this.logger.log(
82+
`Skipping modification: ${modification.id} - ${shouldApplyWithReason.reason}`
83+
);
8084
}
8185
} catch (error) {
8286
if (error instanceof Error) {

api/src/unraid-api/unraid-file-modifier/unraid-file-modifier.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
import { Test, TestingModule } from '@nestjs/testing';
22

3-
import { UnraidFileModifierService } from './unraid-file-modifier.service';
3+
import { UnraidFileModificationService } from '@app/unraid-api/unraid-file-modifier/unraid-file-modifier.service';
44

55
describe('FileModificationService', () => {
6-
let service: UnraidFileModifierService;
6+
let service: UnraidFileModificationService;
77

88
beforeEach(async () => {
99
const module: TestingModule = await Test.createTestingModule({
10-
providers: [UnraidFileModifierService],
10+
providers: [UnraidFileModificationService],
1111
}).compile();
1212

13-
service = module.get<UnraidFileModifierService>(UnraidFileModifierService);
13+
service = module.get<UnraidFileModificationService>(UnraidFileModificationService);
1414
});
1515

1616
it('should be defined', () => {

0 commit comments

Comments
 (0)