mirror of
https://github.com/Start9Labs/start-sdk.git
synced 2026-03-26 10:21:55 +00:00
feat: Effects that shouldn't be needed removed from utils
This commit is contained in:
38
lib/test/utils.splitCommand.test.ts
Normal file
38
lib/test/utils.splitCommand.test.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import { getHostname } from "../util/getNetworkInterface"
|
||||
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"]],
|
||||
// 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