From b2e905ebd23ef1c365b4ff5b713b258154e8823d Mon Sep 17 00:00:00 2001 From: Sam Carlton Date: Mon, 29 Nov 2021 00:15:42 -0600 Subject: [PATCH] Test that each app status has an emoij --- test/prebuild.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/prebuild.js b/test/prebuild.js index 5e32b91..208d307 100644 --- a/test/prebuild.js +++ b/test/prebuild.js @@ -12,6 +12,11 @@ require('dotenv').config() const allowedTitleCharacters = new Set( 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890 -_.®/\()音乐体验版'.split('') ) +// Detect Emojis(Extended Pictograph) in string +// https://stackoverflow.com/a/64007175/1397641 +function hasEmoji ( string ) { + return /\p{Extended_Pictographic}/u.test( string ) +} test.before(async t => { const readmeFileContent = await fs.readFile('./README.md', 'utf-8') @@ -54,6 +59,12 @@ test('README Apps are formated correctly', (t) => { t.fail(`README App ${readmeApp.name} markdown in status text`) } + // Check that status has an emoji + if ( hasEmoji( readmeApp.text ) === false ) { + t.fail(`README App ${readmeApp.name} does not have emoji`) + } + + // Check for not allowed characters in app name for ( const character of cleanedAppName ) { if ( !allowedTitleCharacters.has( character ) ) {