refactor(server): app init (#2638)

This commit is contained in:
Jason Rasmussen
2023-06-01 21:54:16 -04:00
committed by GitHub
parent 4350f9363d
commit 800f010383
8 changed files with 42 additions and 37 deletions

View File

@@ -110,11 +110,11 @@ describe(SearchService.name, () => {
});
});
describe(`bootstrap`, () => {
describe(`init`, () => {
it('should skip when search is disabled', async () => {
const sut = makeSut('false');
await sut.bootstrap();
await sut.init();
expect(searchMock.setup).not.toHaveBeenCalled();
expect(searchMock.checkMigrationStatus).not.toHaveBeenCalled();
@@ -125,7 +125,7 @@ describe(SearchService.name, () => {
it('should skip schema migration if not needed', async () => {
searchMock.checkMigrationStatus.mockResolvedValue({ assets: false, albums: false, faces: false });
await sut.bootstrap();
await sut.init();
expect(searchMock.setup).toHaveBeenCalled();
expect(jobMock.queue).not.toHaveBeenCalled();
@@ -133,7 +133,7 @@ describe(SearchService.name, () => {
it('should do schema migration if needed', async () => {
searchMock.checkMigrationStatus.mockResolvedValue({ assets: true, albums: true, faces: true });
await sut.bootstrap();
await sut.init();
expect(searchMock.setup).toHaveBeenCalled();
expect(jobMock.queue.mock.calls).toEqual([

View File

@@ -80,7 +80,7 @@ export class SearchService {
};
}
async bootstrap() {
async init() {
if (!this.enabled) {
return;
}