UNPKG

asksuite-core

Version:
32 lines (24 loc) 1.18 kB
const StringUtils = require('../util/StringUtils'); describe('Testing hasOnlySpecialChars', () => { it('should return true for string with only special characters', () => { expect(StringUtils.hasOnlySpecialChars('!@#$%^&*()')).toBe(true); }); it('should return false if string contains letters', () => { expect(StringUtils.hasOnlySpecialChars('abc!@#')).toBe(false); }); it('should return false if string contains numbers', () => { expect(StringUtils.hasOnlySpecialChars('123!@#')).toBe(false); }); it('should return false if string contains spaces', () => { expect(StringUtils.hasOnlySpecialChars('!@# $%')).toBe(false); }); it('should return false for empty string', () => { expect(StringUtils.hasOnlySpecialChars('')).toBe(false); }); it('should return true for string like `+=*/?><`', () => { expect(StringUtils.hasOnlySpecialChars('+=*/?><')).toBe(true); }); it('should return false for string in russian', () => { expect(StringUtils.hasOnlySpecialChars('Здравствуйте! С каких дат открывается пирс?')).toBe(false); }); });