Skip to content

Commit

Permalink
IAnnotationsMerger
Browse files Browse the repository at this point in the history
  • Loading branch information
Damien PORTÉ committed Nov 23, 2024
1 parent c3c9a0d commit 8a71dab
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 15 deletions.
2 changes: 1 addition & 1 deletion obsinflate/reports/test-report.html

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@ import {
} from '@obsinflate/core/adobe-digital-editions/epubFile';
import { Annotation } from '@obsinflate/core/adobe-digital-editions/annotations';

export interface IAnnotationsMerger {
merge(annotations: Annotation[]): EpubFiles;
}

export class AnnotationsMerger implements IAnnotationsMerger {
export class AnnotationsMerger {
constructor(private sorter: IAnnotationsSorter) {}

merge(annotations: Annotation[]): EpubFiles {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ErrorNoticer } from '@obsinflate/core/errorNoticer';
import { IAnnotationsReader } from '@obsinflate/core/adobe-digital-editions/annotationsReader';
import { IFormatter } from '@obsinflate/infrastructure/formatter';
import { EpubFiles } from '@obsinflate/core/adobe-digital-editions/epubFile';
import { IAnnotationsMerger } from '@obsinflate/core/adobe-digital-editions/annotationsMerger';
import { AnnotationsMerger } from '@obsinflate/core/adobe-digital-editions/annotationsMerger';
import { KoboHighlightsImporterSettings } from '@obsinflate/inflates/quick-add/kobo-highlights-extractor/settings';
import { AbstractSettingableScript } from '@obsinflate/api/quick-add/abstractSettingableScript';
import { File } from '@obsinflate/infrastructure/fileSystem';
Expand All @@ -15,7 +15,7 @@ export class KoboHighlightsExtractor extends AbstractSettingableScript<KoboHighl
errorNoticer: ErrorNoticer,
settings: KoboHighlightsImporterSettings,
private annotationsReader: IAnnotationsReader,
private annotationsMerger: IAnnotationsMerger,
private annotationsMerger: AnnotationsMerger,
private annotationsFormatter: IFormatter<EpubFiles>
) {
super(errorNoticer, settings);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
EpubFile,
EpubFiles
} from '@obsinflate/core/adobe-digital-editions/epubFile';
import { IAnnotationsMerger } from '@obsinflate/core/adobe-digital-editions/annotationsMerger';
import { AnnotationsMerger } from '@obsinflate/core/adobe-digital-editions/annotationsMerger';
import { PREVENT_CRASH_STRING } from '@obsinflate/tests/data/constants';

describe('KoboHighlightsExtractor', () => {
Expand All @@ -38,7 +38,7 @@ describe('KoboHighlightsExtractor', () => {
}
})
});
const mockAnnotationsMerger = mock<IAnnotationsMerger>();
const mockAnnotationsMerger = mock<AnnotationsMerger>();
const mockMarkdownQuoteFormatter = mock<IFormatter<EpubFiles>>();
const extractor = new KoboHighlightsExtractor(
errorNoticer,
Expand Down Expand Up @@ -88,7 +88,7 @@ describe('KoboHighlightsExtractor', () => {
const mockAnnotationsReader = mock<IAnnotationsReader>({
read: jest.fn().mockResolvedValue(annotations)
});
const mockAnnotationsMerger = mock<IAnnotationsMerger>();
const mockAnnotationsMerger = mock<AnnotationsMerger>();
const mockMarkdownQuoteFormatter = mock<IFormatter<EpubFiles>>();
const extractor = new KoboHighlightsExtractor(
errorNoticer,
Expand Down Expand Up @@ -151,7 +151,7 @@ describe('KoboHighlightsExtractor', () => {
}
files.push(file);
}
const mockAnnotationsMerger = mock<IAnnotationsMerger>({
const mockAnnotationsMerger = mock<AnnotationsMerger>({
merge: jest.fn().mockReturnValue({ files })
});
const mockMarkdownQuoteFormatter = mock<IFormatter<EpubFiles>>();
Expand Down Expand Up @@ -197,7 +197,7 @@ describe('KoboHighlightsExtractor', () => {
const mockAnnotationsReader = mock<IAnnotationsReader>({
read: jest.fn().mockResolvedValue(annotations)
});
const mockAnnotationsMerger = mock<IAnnotationsMerger>();
const mockAnnotationsMerger = mock<AnnotationsMerger>();
const mockMarkdownQuoteFormatter = mock<IFormatter<EpubFiles>>();
const extractor = new KoboHighlightsExtractor(
errorNoticer,
Expand Down Expand Up @@ -240,7 +240,7 @@ describe('KoboHighlightsExtractor', () => {
const mockAnnotationsReader = mock<IAnnotationsReader>({
read: jest.fn().mockResolvedValue(annotations)
});
const mockAnnotationsMerger = mock<IAnnotationsMerger>();
const mockAnnotationsMerger = mock<AnnotationsMerger>();
const mockMarkdownQuoteFormatter = mock<IFormatter<EpubFiles>>();
const extractor = new KoboHighlightsExtractor(
errorNoticer,
Expand Down Expand Up @@ -283,7 +283,7 @@ describe('KoboHighlightsExtractor', () => {
const mockAnnotationsReader = mock<IAnnotationsReader>({
read: jest.fn().mockResolvedValue(annotations)
});
const mockAnnotationsMerger = mock<IAnnotationsMerger>();
const mockAnnotationsMerger = mock<AnnotationsMerger>();
const mockMarkdownQuoteFormatter = mock<IFormatter<EpubFiles>>({
format: jest.fn().mockReturnValue(mockContent)
});
Expand Down

0 comments on commit 8a71dab

Please sign in to comment.