chore(test): make DIContainer tolerant to missing electron.app for vitest
This commit is contained in:
21
tests/smoke/di-container.test.ts
Normal file
21
tests/smoke/di-container.test.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { DIContainer, resolveTemplatePath, resolveSessionDataPath } from '../../apps/companion/main/di-container';
|
||||
|
||||
describe('DIContainer (smoke) - test-tolerance', () => {
|
||||
it('constructs without electron.app and exposes path resolvers', () => {
|
||||
// Constructing DIContainer should not throw in plain Node (vitest) environment.
|
||||
expect(() => {
|
||||
// Note: getInstance lazily constructs the container
|
||||
DIContainer.resetInstance();
|
||||
DIContainer.getInstance();
|
||||
}).not.toThrow();
|
||||
|
||||
// Path resolvers should return strings
|
||||
const tpl = resolveTemplatePath();
|
||||
const sess = resolveSessionDataPath();
|
||||
expect(typeof tpl).toBe('string');
|
||||
expect(tpl.length).toBeGreaterThan(0);
|
||||
expect(typeof sess).toBe('string');
|
||||
expect(sess.length).toBeGreaterThan(0);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user