mirror of
https://github.com/crypto-pro-web/crypto-pro-js.git
synced 2025-04-21 13:03:07 +03:00
19 lines
829 B
TypeScript
19 lines
829 B
TypeScript
import 'cadesplugin';
|
|
import { hasExtendedKeyUsage } from './hasExtendedKeyUsage';
|
|
|
|
const oidsMock = ['1.3.6.1.4.1.311.80.1', '1.3.6.1.5.5.7.3.2', '1.3.6.1.4.1.311.10.3.12'];
|
|
|
|
describe('hasExtendedKeyUsage', () => {
|
|
test('returns info about existing oids of a certificate', async () => {
|
|
const getExtendedKeyUsageStub = jest.fn(() => oidsMock);
|
|
const certificateStub = { getExtendedKeyUsage: getExtendedKeyUsageStub };
|
|
|
|
expect(await hasExtendedKeyUsage.call(certificateStub, '1.3.6.1.4.1.311.80.1')).toEqual(true);
|
|
expect(await hasExtendedKeyUsage.call(certificateStub, ['1.3.6.1.5.5.7.3.2', '1.3.6.1.4.1.311.10.3.12'])).toEqual(
|
|
true,
|
|
);
|
|
expect(await hasExtendedKeyUsage.call(certificateStub, 'non-existing oid')).toEqual(false);
|
|
expect(getExtendedKeyUsageStub).toBeCalledTimes(3);
|
|
});
|
|
});
|