mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-04-01 21:13:09 +00:00
merge 036, everything broken
This commit is contained in:
42
sdk/lib/test/utils.splitCommand.test.ts
Normal file
42
sdk/lib/test/utils.splitCommand.test.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
import { getHostname } from "../util/getServiceInterface"
|
||||
import { splitCommand } from "../util/splitCommand"
|
||||
|
||||
describe("splitCommand ", () => {
|
||||
const inputToExpected = [
|
||||
["cat", ["cat"]],
|
||||
[["cat"], ["cat"]],
|
||||
[
|
||||
["cat", "hello all my homies"],
|
||||
["cat", "hello all my homies"],
|
||||
],
|
||||
["cat hello world", ["cat", "hello", "world"]],
|
||||
["cat hello 'big world'", ["cat", "hello", "big world"]],
|
||||
[`cat hello "big world"`, ["cat", "hello", "big world"]],
|
||||
[
|
||||
`cat hello "big world's are the greatest"`,
|
||||
["cat", "hello", "big world's are the greatest"],
|
||||
],
|
||||
// Too many spaces
|
||||
["cat ", ["cat"]],
|
||||
[["cat "], ["cat "]],
|
||||
[
|
||||
["cat ", "hello all my homies "],
|
||||
["cat ", "hello all my homies "],
|
||||
],
|
||||
["cat hello world ", ["cat", "hello", "world"]],
|
||||
[
|
||||
" cat hello 'big world' ",
|
||||
["cat", "hello", "big world"],
|
||||
],
|
||||
[
|
||||
` cat hello "big world" `,
|
||||
["cat", "hello", "big world"],
|
||||
],
|
||||
]
|
||||
|
||||
for (const [input, expectValue] of inputToExpected) {
|
||||
test(`should return ${expectValue} for ${input}`, () => {
|
||||
expect(splitCommand(input as any)).toEqual(expectValue)
|
||||
})
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user