@@ -68,6 +68,36 @@ describe('Test #Semantic class for path-based conventional commit logic', functi
6868 assert . strictEqual ( new Semantic ( 'foo/test_bar.js' ) . isTestRelated ( ) , true ) ;
6969 } ) ;
7070 } ) ;
71+
72+ describe ( '#getType()' , function ( ) {
73+ // Rather than true and false like in above tests this actually categorizes and also it closer
74+ // to the real world as it through a hierarchy (for example .yml is config-related unless it is
75+ // for a CI file). But, this doesn't care what the action is like create or delete or modify, so
76+ // it won't impose meaning based on that.
77+ it ( 'can tell a type for a build file' , function ( ) {
78+ assert . strictEqual ( new Semantic ( 'Makefile' ) . getType ( ) , CONVENTIONAL_TYPE . BUILD ) ;
79+ assert . strictEqual ( new Semantic ( 'Gemfile' ) . getType ( ) , CONVENTIONAL_TYPE . BUILD ) ;
80+
81+ assert . strictEqual ( new Semantic ( 'package.json' ) . getType ( ) , CONVENTIONAL_TYPE . BUILD ) ;
82+ assert . strictEqual ( new Semantic ( 'package-lock.json' ) . getType ( ) , CONVENTIONAL_TYPE . BUILD ) ;
83+
84+ assert . strictEqual ( new Semantic ( 'requirements.txt' ) . getType ( ) , CONVENTIONAL_TYPE . BUILD ) ;
85+ assert . strictEqual ( new Semantic ( 'requirements-dev.txt' ) . getType ( ) , CONVENTIONAL_TYPE . BUILD ) ;
86+ } ) ;
87+
88+ // TODO Break into categories
89+ it ( 'can tell a type for other types' , function ( ) {
90+ assert . strictEqual ( new Semantic ( 'foo' ) . getType ( ) , CONVENTIONAL_TYPE . UNKNOWN ) ;
91+
92+ assert . strictEqual ( new Semantic ( 'test/foo.js' ) . getType ( ) , CONVENTIONAL_TYPE . TEST ) ;
93+
94+ assert . strictEqual ( new Semantic ( '.github/workflows/foo.yml' ) . getType ( ) , CONVENTIONAL_TYPE . CI ) ;
95+
96+ assert . strictEqual ( new Semantic ( 'README.md' ) . getType ( ) , CONVENTIONAL_TYPE . DOCS ) ;
97+
98+ assert . strictEqual ( new Semantic ( 'LICENSE' ) . getType ( ) , CONVENTIONAL_TYPE . CHORE ) ;
99+ } ) ;
100+ } ) ;
71101} ) ;
72102
73103describe ( '#getSemanticConvention()' , function ( ) {
0 commit comments