the browser-facing portion of osu!
at master 48 lines 1.2 kB view raw
1// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0. 2// See the LICENCE file in the repository root for full licence text. 3 4import { presence, present } from 'utils/string'; 5 6describe('utils/string', () => { 7 describe('.presence', () => { 8 it('check for non empty string', () => { 9 expect(presence('test')).toBe('test'); 10 }); 11 12 it('check for empty string', () => { 13 expect(presence('')).toBe(null); 14 }); 15 16 it('check for null', () => { 17 expect(presence(null)).toBe(null); 18 }); 19 20 it('check for undefined', () => { 21 expect(presence()).toBe(null); 22 }); 23 }); 24 25 describe('.present', () => { 26 it('check for non empty string', () => { 27 expect(present('test')).toBe(true); 28 }); 29 30 it('check for empty string', () => { 31 expect(present('')).toBe(false); 32 }); 33 34 it('check for null', () => { 35 expect(present(null)).toBe(false); 36 }); 37 38 it('check for undefined', () => { 39 expect(present()).toBe(false); 40 }); 41 }); 42 43 describe('locale file loaded in test runner', () => { 44 it('should be loaded', () => { 45 expect(window.Lang.has('common.confirmation')).toBe(true); 46 }); 47 }); 48});