Files
privacy.sexy/tests/integration/presentation/bootstrapping/ApplicationBootstrapper.spec.ts
undergroundwires 7770a9b521 Refactor DI for simplicity and type safety
This commit improves the dependency injection mechanism by introducing a
custom `injectKey` function.

Key improvements are:

- Enforced type consistency during dependency registration and
  instantiation.
- Simplified injection process, abstracting away the complexity with a
  uniform API, regardless of the dependency's lifetime.
- Eliminated the possibility of `undefined` returns during dependency
  injection, promoting fail-fast behavior.
- Removed the necessity for type casting to `symbol` for injection keys
  in unit tests by using existing types.
- Consalidated imports, combining keys and injection functions in one
  `import` statement.
2023-11-09 13:17:38 +01:00

17 lines
562 B
TypeScript

import { describe } from 'vitest';
import { createApp } from 'vue';
import { ApplicationBootstrapper } from '@/presentation/bootstrapping/ApplicationBootstrapper';
import { expectDoesNotThrowAsync } from '@tests/shared/Assertions/ExpectThrowsAsync';
describe('ApplicationBootstrapper', () => {
it('can bootstrap without errors', async () => {
// arrange
const sut = new ApplicationBootstrapper();
const vueApp = createApp({});
// act
const act = () => sut.bootstrap(vueApp);
// assert
await expectDoesNotThrowAsync(act);
});
});