1
1
/**
2
2
* @license
3
- * Copyright (c) 2021, Oracle and/or its affiliates.
3
+ * Copyright (c) 2021, 2023, Oracle and/or its affiliates.
4
4
* Licensed under The Universal Permissive License (UPL), Version 1.0
5
5
* as shown at https://oss.oracle.com/licenses/upl/
6
6
* @ignore
@@ -34,50 +34,50 @@ describe('general utilities', function () {
34
34
expect ( utils . equals ( 1 , 'a string' ) ) . to . equal ( false ) ;
35
35
expect ( utils . equals ( [ 1 , 2 , 3 ] , { one : 'value' } ) ) . to . equal ( false ) ;
36
36
} ) ;
37
-
37
+
38
38
it ( 'returns true when comparing equal scalars' , function ( ) {
39
39
expect ( utils . equals ( undefined , undefined ) ) . to . equal ( true ) ;
40
40
expect ( utils . equals ( 1 , 8 - 7 ) ) . to . equal ( true ) ;
41
41
expect ( utils . equals ( true , true ) ) . to . equal ( true ) ;
42
42
} ) ;
43
-
43
+
44
44
it ( 'returns false when comparing unequal scalars' , function ( ) {
45
45
expect ( utils . equals ( true , false ) ) . to . equal ( false ) ;
46
46
expect ( utils . equals ( 'abcd' , 'xyz' ) ) . to . equal ( false ) ;
47
47
expect ( utils . equals ( 1 , 5 ) ) . to . equal ( false ) ;
48
48
} ) ;
49
-
49
+
50
50
it ( 'returns false when comparing unequal objects' , function ( ) {
51
51
expect ( utils . equals ( { first : 1 , second : 'both' } , { first : 1 , second : 'neither' } ) ) . to . equal ( false ) ;
52
52
expect ( utils . equals ( { first : 1 , second : 'both' } , { second : 'both' , first : 1 , third : null } ) ) . to . equal ( false ) ;
53
53
expect ( utils . equals ( { first : { nest : 1 } , second : 'both' } , { second : 'both' , first : [ 1 ] } ) ) . to . equal ( false ) ;
54
54
} ) ;
55
-
55
+
56
56
it ( 'returns true when comparing equal objects' , function ( ) {
57
57
expect ( utils . equals ( { first : 1 , second : 'both' } , { first : 1 , second : 'both' } ) ) . to . equal ( true ) ;
58
58
expect ( utils . equals ( { first : 1 , second : 'both' } , { second : 'both' , first : 1 } ) ) . to . equal ( true ) ;
59
59
expect ( utils . equals ( { first : { nest : 1 } , second : 'both' } , { second : 'both' , first : { nest : 1 } } ) ) . to . equal ( true ) ;
60
60
} ) ;
61
-
61
+
62
62
it ( 'returns true when comparing unequal arrays' , function ( ) {
63
63
expect ( utils . equals ( [ 1 , 2 , 3 ] , [ 3 , 1 , 2 ] ) ) . to . equal ( false ) ;
64
64
expect ( utils . equals ( [ { age : 12 , height : 50 } ] , [ { age : 12 , height : 60 } ] ) ) . to . equal ( false ) ;
65
65
} ) ;
66
-
66
+
67
67
it ( 'returns true when comparing equal arrays' , function ( ) {
68
68
expect ( utils . equals ( [ 1 , 2 , 3 ] , [ 1 , 2 , 3 ] ) ) . to . equal ( true ) ;
69
69
expect ( utils . equals ( [ { age : 12 , height : 50 } ] , [ { age : 12 , height : 50 } ] ) ) . to . equal ( true ) ;
70
70
} ) ;
71
71
} ) ;
72
-
72
+
73
73
// Kubernetes uses a modified version of the DNS-1123 standard.
74
74
describe ( 'Kubernetes names' , function ( ) {
75
75
it ( 'recognizes legal Kubernetes names' , function ( ) {
76
76
expect ( utils . isLegalK8sName ( 'aa' ) ) . to . be . true ;
77
77
expect ( utils . isLegalK8sName ( 'aa-bb-cc' ) ) . to . be . true ;
78
78
expect ( utils . isLegalK8sName ( 'aa12-b3' ) ) . to . be . true ;
79
79
} ) ;
80
-
80
+
81
81
it ( 'recognizes illegal Kubernetes names' , function ( ) {
82
82
expect ( utils . isLegalK8sName ( 7 ) ) . to . be . false ;
83
83
expect ( utils . isLegalK8sName ( 'Aa' ) ) . to . be . false ;
@@ -97,12 +97,13 @@ describe('general utilities', function () {
97
97
it ( 'converts illegal to legal names' , function ( ) {
98
98
expect ( utils . toLegalK8sName ( 'AA' ) ) . to . equal ( 'aa' ) ;
99
99
expect ( utils . toLegalK8sName ( 'aa_bb-cc' ) ) . to . equal ( 'aa-bb-cc' ) ;
100
+ expect ( utils . toLegalK8sName ( 'aa_bb_cc' ) ) . to . equal ( 'aa-bb-cc' ) ;
100
101
expect ( utils . toLegalK8sName ( 'aa12.b3' ) ) . to . equal ( 'aa12-b3' ) ;
101
102
expect ( utils . toLegalK8sName ( 'aa12$b3' ) ) . to . equal ( 'aa12-b3' ) ;
102
103
expect ( utils . toLegalK8sName ( '--aa' ) ) . to . equal ( 'aa' ) ;
103
104
expect ( utils . toLegalK8sName ( 'aa--' ) ) . to . equal ( 'aa' ) ;
104
105
expect ( utils . toLegalK8sName ( 'aa-bb-cc-dd-ee-ff-gg-hh-ii-jj-kk-ll-mm-nn-oo-pp-qq-rr-ss-tt-uu-vv-ww-xx-yy-zz' ) )
105
- . to . equal ( 'aa-bb-cc-dd-ee-ff-gg-hh-ii-jj-kk-ll-mm-nn-oo-pp-qq-rr-ss-tt-uu- ' ) ;
106
+ . to . equal ( 'aa-bb-cc-dd-ee-ff-gg-hh-ii-jj-kk-ll-mm-nn-oo-pp-qq-rr-ss-tt-uu' ) ;
106
107
} ) ;
107
108
} ) ;
108
109
} ) ;
0 commit comments