mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-08 11:30:12 +08:00
feat: condition matcher
This commit is contained in:
1 parent
cb26e1dcb0
commit
4f3752060d
3 files changed
+37
-26
No files matched your search
@@ -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)
|
||||
})
|
||||
Reference in new issue
Block a user