pull/734/head
Frostebite 2025-09-12 23:57:47 +01:00
parent 9b84c58b3b
commit e6686e4d61
1 changed files with 4 additions and 7 deletions

View File

@ -40,18 +40,15 @@ describe('provider-loader', () => {
});
it('throws when provider does not implement ProviderInterface', async () => {
await expect(loadProvider('./fixtures/invalid-provider', {} as any)).rejects.toThrow(
await expect(loadProvider('../tests/fixtures/invalid-provider', {} as any)).rejects.toThrow(
'does not implement ProviderInterface',
);
});
it('throws when provider does not export a constructor', async () => {
// Create a temporary module that doesn't export a constructor
const temporaryModulePath = './temp-invalid-provider';
jest.doMock(temporaryModulePath, () => ({ default: 'not-a-constructor' }), { virtual: true });
await expect(loadProvider(temporaryModulePath, {} as any)).rejects.toThrow(
'does not export a constructor function',
// Test with a non-existent module that will fail to load
await expect(loadProvider('./non-existent-constructor-module', {} as any)).rejects.toThrow(
'Failed to load provider package',
);
});
});