mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-24 14:43:08 +03:00
Moved helper util tests to Ghost-SDK/helpers
ref 99b2adc1c82eface95dca2a85d6f62169265d3e4 - these tests belong to @tryghost/helpers as they test code that isn't in this repo
This commit is contained in:
parent
f3627c5fc3
commit
3a2ccea3a9
@ -1,50 +0,0 @@
|
||||
const should = require('should');
|
||||
const helperUtils = require('@tryghost/helpers').utils;
|
||||
|
||||
describe('Helpers Utils', function () {
|
||||
describe('Word Count', function () {
|
||||
it('[success] can count words', function () {
|
||||
var html = 'Some words here',
|
||||
result = helperUtils.countWords(html);
|
||||
|
||||
result.should.equal(3);
|
||||
});
|
||||
|
||||
it('[success] sanitized HTML tags', function () {
|
||||
var html = '<p>This is a text example! Count me in ;)</p>',
|
||||
result = helperUtils.countWords(html);
|
||||
|
||||
result.should.equal(8);
|
||||
});
|
||||
|
||||
it('[success] sanitized non alpha-numeric characters', function () {
|
||||
var html = '<p>This is a text example! I love Döner. Especially number 875.</p>',
|
||||
result = helperUtils.countWords(html);
|
||||
|
||||
result.should.equal(11);
|
||||
});
|
||||
|
||||
it('[success] counted Chinese characters', function () {
|
||||
var html = '<p>我今天在家吃了好多好多好吃的,现在的我非常开心非常满足</p>',
|
||||
result = helperUtils.countWords(html);
|
||||
|
||||
result.should.equal(26);
|
||||
});
|
||||
|
||||
it('[success] sanitized white space correctly', function () {
|
||||
var html = ' <p> This is a text example!\n Count me in ;)</p> ',
|
||||
result = helperUtils.countWords(html);
|
||||
|
||||
result.should.equal(8);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Image Count', function () {
|
||||
it('[success] can count images', function () {
|
||||
var html = '<p>This is a <img src="hello.png"> text example! Count me in ;)</p><img src="hello.png">',
|
||||
result = helperUtils.countImages(html);
|
||||
|
||||
result.should.equal(2);
|
||||
});
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue
Block a user