BREAKING CHANGE(SmartAcme): Refactor challenge handling by removing legacy setChallenge/removeChallenge in favor of pluggable challengeHandlers and update documentation and tests accordingly
This commit is contained in:
21
test/test.certmatcher.ts
Normal file
21
test/test.certmatcher.ts
Normal file
@ -0,0 +1,21 @@
|
||||
import { tap, expect } from '@push.rocks/tapbundle';
|
||||
import { SmartacmeCertMatcher } from '../ts/smartacme.classes.certmatcher.js';
|
||||
|
||||
tap.test('should match 2-level domain', async () => {
|
||||
const matcher = new SmartacmeCertMatcher();
|
||||
expect(matcher.getCertificateDomainNameByDomainName('example.com')).toEqual('example.com');
|
||||
});
|
||||
|
||||
tap.test('should match 3-level domain', async () => {
|
||||
const matcher = new SmartacmeCertMatcher();
|
||||
expect(matcher.getCertificateDomainNameByDomainName('subdomain.example.com')).toEqual('example.com');
|
||||
});
|
||||
|
||||
tap.test('should return undefined for deeper domain', async () => {
|
||||
const matcher = new SmartacmeCertMatcher();
|
||||
// domain with 4 or more levels
|
||||
const result = matcher.getCertificateDomainNameByDomainName('a.b.example.com');
|
||||
expect(result).toEqual(undefined);
|
||||
});
|
||||
|
||||
export default tap.start();
|
Reference in New Issue
Block a user