6
6
* @ignore
7
7
*/
8
8
'use strict' ;
9
+
9
10
const expect = require ( 'chai' ) . expect ;
10
- const { after, before, describe, it} = require ( " mocha" ) ;
11
+ const { after, before, describe, it } = require ( ' mocha' ) ;
11
12
const requirejs = require ( 'requirejs' ) ;
12
13
const testHelper = require ( './test-helper' ) ;
13
14
@@ -30,53 +31,52 @@ describe('general utilities', function () {
30
31
describe ( 'equality' , function ( ) {
31
32
it ( 'returns false when comparing different types' , function ( ) {
32
33
expect ( utils . equals ( null , undefined ) ) . to . equal ( false ) ;
33
- expect ( utils . equals ( 1 , " a string" ) ) . to . equal ( false ) ;
34
- expect ( utils . equals ( [ 1 , 2 , 3 ] , { one : " value" } ) ) . to . equal ( false ) ;
35
- } )
34
+ expect ( utils . equals ( 1 , ' a string' ) ) . to . equal ( false ) ;
35
+ expect ( utils . equals ( [ 1 , 2 , 3 ] , { one : ' value' } ) ) . to . equal ( false ) ;
36
+ } ) ;
36
37
37
38
it ( 'returns true when comparing equal scalars' , function ( ) {
38
39
expect ( utils . equals ( undefined , undefined ) ) . to . equal ( true ) ;
39
40
expect ( utils . equals ( 1 , 8 - 7 ) ) . to . equal ( true ) ;
40
41
expect ( utils . equals ( true , true ) ) . to . equal ( true ) ;
41
- } )
42
+ } ) ;
42
43
43
44
it ( 'returns false when comparing unequal scalars' , function ( ) {
44
45
expect ( utils . equals ( true , false ) ) . to . equal ( false ) ;
45
- expect ( utils . equals ( " abcd" , " xyz" ) ) . to . equal ( false ) ;
46
+ expect ( utils . equals ( ' abcd' , ' xyz' ) ) . to . equal ( false ) ;
46
47
expect ( utils . equals ( 1 , 5 ) ) . to . equal ( false ) ;
47
- } )
48
+ } ) ;
48
49
49
50
it ( 'returns false when comparing unequal objects' , function ( ) {
50
- expect ( utils . equals ( { first : 1 , second : " both" } , { first : 1 , second : " neither" } ) ) . to . equal ( false ) ;
51
- expect ( utils . equals ( { first : 1 , second : " both" } , { second : " both" , first : 1 , third : null } ) ) . to . equal ( false ) ;
52
- expect ( utils . equals ( { first : { nest : 1 } , second : " both" } , { second : " both" , first : [ 1 ] } ) ) . to . equal ( false ) ;
53
- } )
51
+ expect ( utils . equals ( { first : 1 , second : ' both' } , { first : 1 , second : ' neither' } ) ) . to . equal ( false ) ;
52
+ expect ( utils . equals ( { first : 1 , second : ' both' } , { second : ' both' , first : 1 , third : null } ) ) . to . equal ( false ) ;
53
+ expect ( utils . equals ( { first : { nest : 1 } , second : ' both' } , { second : ' both' , first : [ 1 ] } ) ) . to . equal ( false ) ;
54
+ } ) ;
54
55
55
56
it ( 'returns true when comparing equal objects' , function ( ) {
56
- expect ( utils . equals ( { first : 1 , second : " both" } , { first : 1 , second : " both" } ) ) . to . equal ( true ) ;
57
- expect ( utils . equals ( { first : 1 , second : " both" } , { second : " both" , first : 1 } ) ) . to . equal ( true ) ;
58
- expect ( utils . equals ( { first : { nest : 1 } , second : " both" } , { second : " both" , first : { nest : 1 } } ) ) . to . equal ( true ) ;
59
- } )
57
+ expect ( utils . equals ( { first : 1 , second : ' both' } , { first : 1 , second : ' both' } ) ) . to . equal ( true ) ;
58
+ expect ( utils . equals ( { first : 1 , second : ' both' } , { second : ' both' , first : 1 } ) ) . to . equal ( true ) ;
59
+ expect ( utils . equals ( { first : { nest : 1 } , second : ' both' } , { second : ' both' , first : { nest : 1 } } ) ) . to . equal ( true ) ;
60
+ } ) ;
60
61
61
62
it ( 'returns true when comparing unequal arrays' , function ( ) {
62
63
expect ( utils . equals ( [ 1 , 2 , 3 ] , [ 3 , 1 , 2 ] ) ) . to . equal ( false ) ;
63
64
expect ( utils . equals ( [ { age : 12 , height : 50 } ] , [ { age : 12 , height : 60 } ] ) ) . to . equal ( false ) ;
64
- } )
65
+ } ) ;
65
66
66
67
it ( 'returns true when comparing equal arrays' , function ( ) {
67
68
expect ( utils . equals ( [ 1 , 2 , 3 ] , [ 1 , 2 , 3 ] ) ) . to . equal ( true ) ;
68
69
expect ( utils . equals ( [ { age : 12 , height : 50 } ] , [ { age : 12 , height : 50 } ] ) ) . to . equal ( true ) ;
69
- } )
70
-
71
- } )
70
+ } ) ;
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 ;
@@ -86,13 +86,13 @@ describe('general utilities', function () {
86
86
expect ( utils . isLegalK8sName ( '-aa' ) ) . to . be . false ;
87
87
expect ( utils . isLegalK8sName ( 'aa-' ) ) . to . be . false ;
88
88
expect ( utils . isLegalK8sName ( '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' ) ) . to . be . false ;
89
- } )
89
+ } ) ;
90
90
91
91
it ( 'does not change legal Kubernetes names' , function ( ) {
92
92
expect ( utils . toLegalK8sName ( 'aa' ) ) . to . equal ( 'aa' ) ;
93
93
expect ( utils . toLegalK8sName ( 'aa-bb-cc' ) ) . to . equal ( 'aa-bb-cc' ) ;
94
94
expect ( utils . toLegalK8sName ( 'aa12-b3' ) ) . to . equal ( 'aa12-b3' ) ;
95
- } )
95
+ } ) ;
96
96
97
97
it ( 'converts illegal to legal names' , function ( ) {
98
98
expect ( utils . toLegalK8sName ( 'AA' ) ) . to . equal ( 'aa' ) ;
@@ -103,6 +103,6 @@ describe('general utilities', function () {
103
103
expect ( utils . toLegalK8sName ( 'aa--' ) ) . to . equal ( 'aa' ) ;
104
104
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
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
- } )
107
- } )
106
+ } ) ;
107
+ } ) ;
108
108
} ) ;
0 commit comments