@@ -35,9 +35,9 @@ describe('ns', function() {
3535 assert . equal ( ns ( 'local.oplog.$foo' ) . oplog , false ) ;
3636 } ) ;
3737
38- it ( 'should identify special namespaces' , function ( ) {
39- it ( 'should acccept `a.$.b`' , function ( ) {
40- assert ( ns ( 'a.$.b' ) . special ) ;
38+ describe ( 'should identify special namespaces' , function ( ) {
39+ it ( 'should NOT accept `a.$.b as special `' , function ( ) {
40+ assert . equal ( ns ( 'a.$.b' ) . special , false ) ;
4141 } ) ;
4242 it ( 'should acccept `a.system.foo`' , function ( ) {
4343 assert ( ns ( 'a.system.foo' ) . special ) ;
@@ -54,6 +54,43 @@ describe('ns', function() {
5454 it ( 'should not accept `a.foo.system.bar`' , function ( ) {
5555 assert . equal ( ns ( 'a.foo.system.bar' ) . special , false ) ;
5656 } ) ;
57+ it ( 'should not accept `prefix__mdb_internal_suffix`' , function ( ) {
58+ assert . equal ( ns ( 'prefix__mdb_internal_suffix' ) . special , false ) ;
59+ } ) ;
60+ it ( 'should not accept `anyDB.prefix__mdb_internal_suffix`' , function ( ) {
61+ assert . equal ( ns ( 'anyDB.prefix__mdb_internal_itsACollectionNow' ) . special , false ) ;
62+ } ) ;
63+ it ( 'should not accept `prefix__mdb_internal_suffix`' , function ( ) {
64+ assert . equal ( ns ( 'prefix__mdb_internal_' ) . special , false ) ;
65+ } ) ;
66+ it ( 'should acccept `__mdb_internal_suffix`' , function ( ) {
67+ assert ( ns ( '__mdb_internal_suffix' ) . special ) ;
68+ } ) ;
69+ } ) ;
70+
71+ describe ( 'should identify system namespaces' , function ( ) {
72+ it ( 'should acccept `anyDB.enxcol_.` as system`' , function ( ) {
73+ assert ( ns ( 'anyDB.enxcol_.' ) . system ) ;
74+ } ) ;
75+ it ( 'should acccept `anyDB.system.` as system`' , function ( ) {
76+ assert ( ns ( 'anyDB.system.' ) . system ) ;
77+ } ) ;
78+ it ( 'should acccept `anyDB.system.anyCollSuffix` as system`' , function ( ) {
79+ assert ( ns ( 'anyDB.system.anyCollSuffix' ) . system ) ;
80+ } ) ;
81+ it ( 'should NOT acccept `anyDB.anyCollPrefix.system` as system`' , function ( ) {
82+ assert . equal ( ( ns ( 'anyDB.anyCollPrefix.system' ) . system ) , false ) ;
83+ } ) ;
84+ it ( 'should NOT acccept `anyDB.system` as system`' , function ( ) {
85+ assert . equal ( ( ns ( 'anyDB.system' ) . system ) , false ) ;
86+ } ) ;
87+ // exception for system.profile COMPASS-9377
88+ it ( 'should NOT acccept `anyDB.system.profile as system`' , function ( ) {
89+ assert . equal ( ( ns ( 'anyDB.system.profile' ) . system ) , false ) ;
90+ } ) ;
91+ it ( 'should acccept `anyDB.system.profile_anything as system`' , function ( ) {
92+ assert ( ns ( 'anyDB.system.profile_anything' ) . system ) ;
93+ } ) ;
5794 } ) ;
5895
5996 describe ( 'database name validation' , function ( ) {
0 commit comments