summaryrefslogtreecommitdiff
path: root/node_modules/i/test/inflector/inflections-test.js
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2021-12-21 16:50:49 +0100
committerMinteck <contact@minteck.org>2021-12-21 16:50:49 +0100
commit20204baf1807825af4798ad03bfb329e4da05bc5 (patch)
tree1568515fa1e4592206ed5d2327b39e6b443cbd03 /node_modules/i/test/inflector/inflections-test.js
downloadbingoloto-remote-20204baf1807825af4798ad03bfb329e4da05bc5.tar.gz
bingoloto-remote-20204baf1807825af4798ad03bfb329e4da05bc5.tar.bz2
bingoloto-remote-20204baf1807825af4798ad03bfb329e4da05bc5.zip
Commit
Diffstat (limited to 'node_modules/i/test/inflector/inflections-test.js')
-rw-r--r--node_modules/i/test/inflector/inflections-test.js87
1 files changed, 87 insertions, 0 deletions
diff --git a/node_modules/i/test/inflector/inflections-test.js b/node_modules/i/test/inflector/inflections-test.js
new file mode 100644
index 0000000..be8d960
--- /dev/null
+++ b/node_modules/i/test/inflector/inflections-test.js
@@ -0,0 +1,87 @@
+(function() {
+ var assert, vows;
+
+ vows = require('vows');
+
+ assert = require('assert');
+
+ vows.describe('Module Inflector inflections').addBatch({
+ 'Test inflector inflections': {
+ topic: require('../../lib/inflections'),
+ 'clear': {
+ 'single': function(topic) {
+ topic.uncountables = [1, 2, 3];
+ topic.humans = [1, 2, 3];
+ topic.clear('uncountables');
+ assert.isEmpty(topic.uncountables);
+ return assert.deepEqual(topic.humans, [1, 2, 3]);
+ },
+ 'all': function(topic) {
+ assert.deepEqual(topic.humans, [1, 2, 3]);
+ topic.uncountables = [1, 2, 3];
+ topic.clear();
+ assert.isEmpty(topic.uncountables);
+ return assert.isEmpty(topic.humans);
+ }
+ },
+ 'uncountable': {
+ 'one item': function(topic) {
+ topic.clear();
+ assert.isEmpty(topic.uncountables);
+ topic.uncountable('money');
+ return assert.deepEqual(topic.uncountables, ['money']);
+ },
+ 'many items': function(topic) {
+ topic.clear();
+ assert.isEmpty(topic.uncountables);
+ topic.uncountable(['money', 'rice']);
+ return assert.deepEqual(topic.uncountables, ['money', 'rice']);
+ }
+ },
+ 'human': function(topic) {
+ topic.clear();
+ assert.isEmpty(topic.humans);
+ topic.human("legacy_col_person_name", "Name");
+ return assert.deepEqual(topic.humans, [["legacy_col_person_name", "Name"]]);
+ },
+ 'plural': function(topic) {
+ topic.clear();
+ assert.isEmpty(topic.plurals);
+ topic.plural('ox', 'oxen');
+ assert.deepEqual(topic.plurals, [['ox', 'oxen']]);
+ topic.uncountable('money');
+ assert.deepEqual(topic.uncountables, ['money']);
+ topic.uncountable('monies');
+ topic.plural('money', 'monies');
+ assert.deepEqual(topic.plurals, [['money', 'monies'], ['ox', 'oxen']]);
+ return assert.isEmpty(topic.uncountables);
+ },
+ 'singular': function(topic) {
+ topic.clear();
+ assert.isEmpty(topic.singulars);
+ topic.singular('ox', 'oxen');
+ assert.deepEqual(topic.singulars, [['ox', 'oxen']]);
+ topic.uncountable('money');
+ assert.deepEqual(topic.uncountables, ['money']);
+ topic.uncountable('monies');
+ topic.singular('money', 'monies');
+ assert.deepEqual(topic.singulars, [['money', 'monies'], ['ox', 'oxen']]);
+ return assert.isEmpty(topic.uncountables);
+ },
+ 'irregular': function(topic) {
+ topic.clear();
+ topic.uncountable(['octopi', 'octopus']);
+ assert.deepEqual(topic.uncountables, ['octopi', 'octopus']);
+ topic.irregular('octopus', 'octopi');
+ assert.isEmpty(topic.uncountables);
+ assert.equal(topic.singulars[0][0].toString(), /(o)ctopi$/i.toString());
+ assert.equal(topic.singulars[0][1], '$1ctopus');
+ assert.equal(topic.plurals[0][0].toString(), /(o)ctopi$/i.toString());
+ assert.equal(topic.plurals[0][1], '$1ctopi');
+ assert.equal(topic.plurals[1][0].toString(), /(o)ctopus$/i.toString());
+ return assert.equal(topic.plurals[1][1].toString(), '$1ctopi');
+ }
+ }
+ })["export"](module);
+
+}).call(this);