@@ -3,7 +3,7 @@ import { validateCommitOrder } from "../src/utils/validateCommits";
3
3
describe ( "commitOrder" , ( ) => {
4
4
describe ( "#.# format" , ( ) => {
5
5
it ( "should return true if order is valid" , ( ) => {
6
- const positions = [ "INIT" , "1" , "1.1" , "1.2" , "2" , "2.1" ] ;
6
+ const positions = [ "INIT" , "1" , "1.1:T " , "1.2:T " , "2" , "2.1:T " ] ;
7
7
const result = validateCommitOrder ( positions ) ;
8
8
expect ( result ) . toBe ( true ) ;
9
9
} ) ;
@@ -13,81 +13,35 @@ describe("commitOrder", () => {
13
13
"INIT" ,
14
14
"1" ,
15
15
"1" ,
16
- "1.1" ,
17
- "1.1" ,
18
- "1.2" ,
19
- "1.2" ,
16
+ "1.1:T " ,
17
+ "1.1:S " ,
18
+ "1.2:T " ,
19
+ "1.2:S " ,
20
20
"2" ,
21
21
"2" ,
22
- "2.1" ,
23
- "2.1" ,
22
+ "2.1:T " ,
23
+ "2.1:S " ,
24
24
] ;
25
25
const result = validateCommitOrder ( positions ) ;
26
26
expect ( result ) . toBe ( true ) ;
27
27
} ) ;
28
28
it ( "should return false if INIT is out of order" , ( ) => {
29
- const positions = [ "INIT" , "1" , "1.1" , "1.2" , "INIT" , "2" , "2.1" ] ;
29
+ const positions = [ "INIT" , "1" , "1.1:T " , "1.2:T " , "INIT" , "2" , "2.1:T " ] ;
30
30
const result = validateCommitOrder ( positions ) ;
31
31
expect ( result ) . toBe ( false ) ;
32
32
} ) ;
33
33
it ( "should return false if level after step is out of order" , ( ) => {
34
- const positions = [ "INIT" , "1" , "1.1" , "1.2" , "2.1" , "2" ] ;
34
+ const positions = [ "INIT" , "1" , "1.1:T " , "1.2:T " , "2.1:T " , "2" ] ;
35
35
const result = validateCommitOrder ( positions ) ;
36
36
expect ( result ) . toBe ( false ) ;
37
37
} ) ;
38
38
it ( "should return false if level is out of order" , ( ) => {
39
- const positions = [ "INIT" , "1" , "L3 " , "2" ] ;
39
+ const positions = [ "INIT" , "1" , "3 " , "2" ] ;
40
40
const result = validateCommitOrder ( positions ) ;
41
41
expect ( result ) . toBe ( false ) ;
42
42
} ) ;
43
43
it ( "should return false if step is out of order" , ( ) => {
44
- const positions = [ "INIT" , "1" , "1.1" , "1.3" , "1.2" ] ;
45
- const result = validateCommitOrder ( positions ) ;
46
- expect ( result ) . toBe ( false ) ;
47
- } ) ;
48
- } ) ;
49
- // @deprecated
50
- describe ( "L#S# format" , ( ) => {
51
- it ( "should return true if order is valid" , ( ) => {
52
- const positions = [ "INIT" , "L1" , "L1S1" , "L1S2" , "L2" , "L2S1" ] ;
53
- const result = validateCommitOrder ( positions ) ;
54
- expect ( result ) . toBe ( true ) ;
55
- } ) ;
56
- it ( "should return true if valid with duplicates" , ( ) => {
57
- const positions = [
58
- "INIT" ,
59
- "INIT" ,
60
- "L1" ,
61
- "L1" ,
62
- "L1S1" ,
63
- "L1S1" ,
64
- "L1S2" ,
65
- "L1S2" ,
66
- "L2" ,
67
- "L2" ,
68
- "L2S1" ,
69
- "L2S1" ,
70
- ] ;
71
- const result = validateCommitOrder ( positions ) ;
72
- expect ( result ) . toBe ( true ) ;
73
- } ) ;
74
- it ( "should return false if INIT is out of order" , ( ) => {
75
- const positions = [ "INIT" , "L1" , "L1S1" , "L1S2" , "INIT" , "L2" , "L2S1" ] ;
76
- const result = validateCommitOrder ( positions ) ;
77
- expect ( result ) . toBe ( false ) ;
78
- } ) ;
79
- it ( "should return false if level after step is out of order" , ( ) => {
80
- const positions = [ "INIT" , "L1" , "L1S1" , "L1S2" , "L2S1" , "L2" ] ;
81
- const result = validateCommitOrder ( positions ) ;
82
- expect ( result ) . toBe ( false ) ;
83
- } ) ;
84
- it ( "should return false if level is out of order" , ( ) => {
85
- const positions = [ "INIT" , "L1" , "L3" , "L2" ] ;
86
- const result = validateCommitOrder ( positions ) ;
87
- expect ( result ) . toBe ( false ) ;
88
- } ) ;
89
- it ( "should return false if step is out of order" , ( ) => {
90
- const positions = [ "INIT" , "L1" , "L1S1" , "L1S3" , "L1S2" ] ;
44
+ const positions = [ "INIT" , "1" , "1.1:T" , "1.3:T" , "1.2:T" ] ;
91
45
const result = validateCommitOrder ( positions ) ;
92
46
expect ( result ) . toBe ( false ) ;
93
47
} ) ;
0 commit comments