mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-06 03:20:13 +08:00
feat: add output matcher
This commit is contained in:
1 parent
9eb08b45f4
commit
cb26e1dcb0
2 files changed
+14
No files matched your search
@@ -4,6 +4,7 @@ import {
|
||||
CommandMatcher,
|
||||
ErrorMatcher,
|
||||
PwdMatcher,
|
||||
OutputMatcher,
|
||||
Condition,
|
||||
} from '../src/condition'
|
||||
import { Command } from '../src/command'
|
||||
@@ -63,6 +64,13 @@ test('pwd matcher', () => {
|
||||
expect(matcher.match({ pwd: '/var/home/user' })).toBe(false)
|
||||
})
|
||||
|
||||
test('output matcher', () => {
|
||||
const matcher = new OutputMatcher('^start$')
|
||||
expect(matcher.match({ output: 'start' })).toBe(true)
|
||||
expect(matcher.match({ output: 'start1' })).toBe(false)
|
||||
expect(matcher.match({ output: 'start\n' })).toBe(true)
|
||||
})
|
||||
|
||||
// test('condition match', () => {
|
||||
// const condition = new Condition({
|
||||
// command: '^echo start$',
|
||||
|
||||
Reference in new issue
Block a user