mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-08 03:20:12 +08:00
refactor: remove unnecessary patter matcher
This commit is contained in:
1 parent
4f3752060d
commit
8280f7073d
2 files changed
+11
-33
No files matched your search
@@ -1,6 +1,5 @@
|
||||
import { test, expect } from '@jest/globals'
|
||||
import {
|
||||
PatternMatcher,
|
||||
CommandMatcher,
|
||||
ErrorMatcher,
|
||||
PwdMatcher,
|
||||
@@ -9,26 +8,6 @@ import {
|
||||
} from '../src/condition'
|
||||
import { Command } from '../src/command'
|
||||
|
||||
test('pattern match', () => {
|
||||
const matcher = new PatternMatcher('^echo start$')
|
||||
|
||||
expect(matcher.test('echo start')).toBe(true)
|
||||
expect(matcher.test('echo start ')).toBe(false)
|
||||
})
|
||||
|
||||
test('pattern match with flag', () => {
|
||||
const matcher = new PatternMatcher('^echo start$', 'i')
|
||||
|
||||
expect(matcher.test('echo start')).toBe(true)
|
||||
expect(matcher.test('echo Start')).toBe(true)
|
||||
expect(matcher.test('echo Start ')).toBe(false)
|
||||
})
|
||||
|
||||
test('empty pattern return true', () => {
|
||||
const matcher = new PatternMatcher('')
|
||||
expect(matcher.test('echo start')).toBe(true)
|
||||
})
|
||||
|
||||
test('command match', () => {
|
||||
const command: Command = {
|
||||
command: 'echo start',
|
||||
|
||||
Reference in new issue
Block a user