-
-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathparse_command_utils.js
49 lines (40 loc) · 1.96 KB
/
parse_command_utils.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import { parseGuid } from '#lib/parse_command_utils'
import 'should'
describe('parseGuid', () => {
it('should support a valid item guid', async () => {
const guid = 'Q235116$6E538A76-DDE7-4ED4-AE4F-6BCCFD6B74A5'
parseGuid(guid).should.equal(guid)
})
it('should support shell-friendly hyphenated item guid', async () => {
const guid = 'Q235116-6E538A76-DDE7-4ED4-AE4F-6BCCFD6B74A5'
parseGuid(guid).should.equal('Q235116$6E538A76-DDE7-4ED4-AE4F-6BCCFD6B74A5')
})
it('should support prefixed hyphenated item guid', async () => {
const guid = 'wds:Q235116-6E538A76-DDE7-4ED4-AE4F-6BCCFD6B74A5'
parseGuid(guid).should.equal('Q235116$6E538A76-DDE7-4ED4-AE4F-6BCCFD6B74A5')
})
it('should support an over-escaped item guid', async () => {
const guid = 'Q235116\\$6E538A76-DDE7-4ED4-AE4F-6BCCFD6B74A5'
parseGuid(guid).should.equal('Q235116$6E538A76-DDE7-4ED4-AE4F-6BCCFD6B74A5')
})
it('should support a double quoted item guid', async () => {
const guid = '"Q235116$6E538A76-DDE7-4ED4-AE4F-6BCCFD6B74A5"'
parseGuid(guid).should.equal('Q235116$6E538A76-DDE7-4ED4-AE4F-6BCCFD6B74A5')
})
it('should support a simple quoted item guid', async () => {
const guid = "'Q235116$6E538A76-DDE7-4ED4-AE4F-6BCCFD6B74A5'"
parseGuid(guid).should.equal('Q235116$6E538A76-DDE7-4ED4-AE4F-6BCCFD6B74A5')
})
it('should support a valid lexem form guid', async () => {
const guid = 'L235116-F1$6E538A76-DDE7-4ED4-AE4F-6BCCFD6B74A5'
parseGuid(guid).should.equal(guid)
})
it('should support shell-friendly hyphenated lexem form guid', async () => {
const guid = 'L235116-F1-6E538A76-DDE7-4ED4-AE4F-6BCCFD6B74A5'
parseGuid(guid).should.equal('L235116-F1$6E538A76-DDE7-4ED4-AE4F-6BCCFD6B74A5')
})
it('should support prefixed hyphenated lexem form guid', async () => {
const guid = 'wds:L235116-F1-6E538A76-DDE7-4ED4-AE4F-6BCCFD6B74A5'
parseGuid(guid).should.equal('L235116-F1$6E538A76-DDE7-4ED4-AE4F-6BCCFD6B74A5')
})
})