feat: add global exceptions

This commit is contained in:
Justin Lin committed 2025-04-21 11:41:07 +08:00
1 parent fb823814e0
commit cfce5ececa
6 files changed
+71 -5

No files matched your search

+8
View File
@@ -5,6 +5,7 @@ import { PwdMatcher } from '../src/condition/PwdMatcher'
import { CommandMatcher } from '../src/condition/CommandMatcher'
import { ErrorMatcher } from '../src/condition/ErrorMatcher.js'
import { conditionSchema } from '../src/schema'
import { MockFileChecker } from './asyncCondition.test'
test('command match', () => {
const matcher = new CommandMatcher('^echo start$')
@@ -92,3 +93,10 @@ it('should parse condition', () => {
}
expect(conditionSchema.safeParse(condition).error).toBeUndefined()
})
it('should not match empty condition', async () => {
const condition = new Condition({})
expect(
await condition.satisfies({ command: 'echo start' }, new MockFileChecker())
).toBe(false)
})