feat: condition matcher

This commit is contained in:
wancat committed 2024-03-06 23:54:03 +08:00
1 parent cb26e1dcb0
commit 4f3752060d
3 files changed
+37 -26

No files matched your search

+18 -18
View File
@@ -71,22 +71,22 @@ test('output matcher', () => {
expect(matcher.match({ output: 'start\n' })).toBe(true)
})
// test('condition match', () => {
// const condition = new Condition({
// command: '^echo start$',
// pwd: '/home/user',
// })
test('condition match', () => {
const condition = new Condition({
command: '^echo start$',
})
// expect(
// condition.match({
// command: 'echo start',
// pwd: '/home/user',
// })
// ).toBe(true)
// expect(
// condition.match({
// command: 'echo start',
// pwd: '/home/user1',
// })
// ).toBe(false)
// })
expect(
condition.match({
command: 'echo start',
})
).toBe(true)
expect(
condition.match({
command: 'echo hello',
})
).toBe(false)
expect(
condition.match({ command: 'echo start', error: 'permission denied' })
).toBe(false)
})