11import type { Commit , RuleConfigCondition } from '@commitlint/types' ;
2+ import { gitmojis } from 'gitmojis' ;
3+
24import emojiRule from '../src/rule' ;
35
46const when : RuleConfigCondition = 'always' ;
@@ -25,7 +27,7 @@ describe('commit start with gitmoji code', () => {
2527 const value = emojiRule ( { raw : '🤔 chore(scope): test' } as Commit , when ) ;
2628 expect ( value ) . toEqual ( [
2729 false ,
28- 'Your commit should start with gitmoji code. Please check the emoji code on https://gitmoji.dev/.' ,
30+ '🤔 is not in the correct gitmoji list, please check the emoji code on https://gitmoji.dev/.' ,
2931 ] ) ;
3032 } ) ;
3133
@@ -42,6 +44,11 @@ describe('commit start with gitmoji code', () => {
4244 expect ( value ) . toEqual ( [ true , 'passed' ] ) ;
4345 } ) ;
4446
47+ it ( ':construction_worker: should pass' , ( ) => {
48+ const value = emojiRule ( { raw : ':construction_worker: test' } as Commit , when ) ;
49+ expect ( value ) . toEqual ( [ true , 'passed' ] ) ;
50+ } ) ;
51+
4552 it ( '🎉 should pass' , ( ) => {
4653 const value = emojiRule ( { raw : '🎉 test' } as Commit , when ) ;
4754 expect ( value ) . toEqual ( [ true , 'passed' ] ) ;
@@ -56,4 +63,19 @@ describe('commit start with gitmoji code', () => {
5663 const value = emojiRule ( { raw : '💄 test' } as Commit , when ) ;
5764 expect ( value ) . toEqual ( [ true , 'passed' ] ) ;
5865 } ) ;
66+
67+ it ( '⚡️should pass' , ( ) => {
68+ const value = emojiRule ( { raw : '⚡️ test' } as Commit , when ) ;
69+ expect ( value ) . toEqual ( [ true , 'passed' ] ) ;
70+ } ) ;
71+
72+ it ( 'every emoji in list past' , ( ) => {
73+ const gitmojiUnicode : string [ ] = gitmojis . map ( ( gitmoji ) => gitmoji . emoji ) ;
74+
75+ gitmojiUnicode . forEach ( ( unicode ) => {
76+ const value = emojiRule ( { raw : `${ unicode } test` } as Commit , when ) ;
77+ console . log ( `testing ${ unicode } ...` ) ;
78+ expect ( value ) . toEqual ( [ true , 'passed' ] ) ;
79+ } ) ;
80+ } ) ;
5981} ) ;
0 commit comments