This repository was archived by the owner on Jul 23, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 521
Expand file tree
/
Copy pathbackwardsTest.js
More file actions
55 lines (48 loc) · 1.54 KB
/
backwardsTest.js
File metadata and controls
55 lines (48 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
'use strict';
var emojione = require("../emojione");
var assert = require("assert");
var asciiEmojis = Object.keys(emojione.asciiList);
var shortnames = Object.keys(emojione.emojioneList);
for (var short in emojione.emojioneList)
if (emojione.emojioneList[short].shortnames)
shortnames = shortnames.concat(emojione.emojioneList[short].shortnames);
try {
var translations = require("./translations.json");
} catch (e) {
throw new Error("No translation.json found. Use generateCurrentTranslations.js to generate it for this version.");
}
var functions = require("./functionsAndOptionsToCheck.json");
Object.keys(functions).forEach(function (functionName) {
suite(functionName,function () {
functions[functionName].forEach(function (options) {
var optionsName = JSON.stringify(options);
suite(optionsName, function () {
var oldOptions = {};
for (var k in options)
oldOptions[k] = emojione[k];
suiteSetup(function () {
for (var k in options)
emojione[k] = options[k];
});
suiteTeardown(function () {
for (var k in options)
emojione[k] = oldOptions[k];
});
suite("ascii", function () {
asciiEmojis.forEach(function (k) {
test(k, function () {
assert.equal(emojione.toImage(k), translations[functionName][optionsName][k]);
});
});
});
suite("shortnames", function () {
shortnames.forEach(function (k) {
test(k, function () {
assert.equal(emojione.toImage(k), translations[functionName][optionsName][k]);
});
});
});
});
});
});
});