diff --git a/Document.js b/Document.js index 002a241..62ab1ab 100644 --- a/Document.js +++ b/Document.js @@ -142,26 +142,6 @@ Document.prototype.getSourceId = function(){ return this.source_id; }; -// alpha3 -Document.prototype.setAlpha3 = function( alpha3 ){ - - alpha3 = transform.uppercase(alpha3); - validate.type('string', alpha3); - validate.truthy(alpha3); - validate.length(3, alpha3); - - this.alpha3 = alpha3; - return this; -}; - -Document.prototype.getAlpha3 = function(){ - return this.alpha3; -}; - -Document.prototype.clearAlpha3 = function(){ - delete this.alpha3; -}; - // globally unique id Document.prototype.getGid = function(){ return [ this.getSource(), this.getLayer(), this.getId() ].join(':'); diff --git a/test/document/alpha3.js b/test/document/alpha3.js deleted file mode 100644 index e4ed2e2..0000000 --- a/test/document/alpha3.js +++ /dev/null @@ -1,64 +0,0 @@ - -var Document = require('../../Document'); - -module.exports.tests = {}; - -module.exports.tests.getAlpha3 = function(test) { - test('getAlpha3', function(t) { - var doc = new Document('mysource','mylayer','myid'); - doc.alpha3 = 'GBR'; - t.equal(doc.getAlpha3(), 'GBR', 'getter works'); - t.end(); - }); -}; - -module.exports.tests.setAlpha3 = function(test) { - test('setAlpha3', function(t) { - var doc = new Document('mysource','mylayer','myid'); - t.equal(doc.alpha3, undefined, 'alpha3 undefined'); - t.equal(doc.setAlpha3('FOO'), doc, 'chainable'); - t.equal(doc.alpha3, 'FOO', 'alpha3 set'); - t.end(); - }); - test('setAlpha3 - validate', function(t) { - var doc = new Document('mysource','mylayer','myid'); - t.throws( doc.setAlpha3.bind(doc,1), null, 'invalid alpha3' ); - t.throws( doc.setAlpha3.bind(doc,''), null, 'invalid length' ); - t.throws( doc.setAlpha3.bind(doc,'GB'), null, 'invalid length' ); - t.throws( doc.setAlpha3.bind(doc,'GBRX'), null, 'invalid length' ); - t.end(); - }); - test('setAlpha3 - transform', function(t) { - var doc = new Document('mysource','mylayer','myid'); - doc.setAlpha3('foo'); - t.equal(doc.alpha3, 'FOO', 'accepts lowercase'); - t.end(); - }); -}; - -module.exports.tests.clearAlpha3 = (test) => { - test('clearAlpha3', (t) => { - var doc = new Document('mysource','mylayer','myid'); - doc.setAlpha3('FOO'); - - t.equal(doc.getAlpha3(), 'FOO', 'alpha3 set'); - - doc.clearAlpha3(); - - t.equal(doc.getAlpha3(), undefined, 'alpha3 cleared'); - t.end(); - - }); - -}; - -module.exports.all = function (tape, common) { - - function test(name, testFunction) { - return tape('alpha3: ' + name, testFunction); - } - - for( var testCase in module.exports.tests ){ - module.exports.tests[testCase](test, common); - } -}; diff --git a/test/run.js b/test/run.js index 9e46d7b..68f1880 100644 --- a/test/run.js +++ b/test/run.js @@ -4,7 +4,6 @@ var common = {}; var tests = [ require('./Document.js'), require('./errors.js'), - require('./document/alpha3.js'), require('./document/centroid.js'), require('./document/gid.js'), require('./document/id.js'), diff --git a/test/serialize/test.js b/test/serialize/test.js index 8e9cd6d..d7832be 100644 --- a/test/serialize/test.js +++ b/test/serialize/test.js @@ -45,7 +45,6 @@ module.exports.tests.complete = function(test) { // create a new doc and serialize it var doc = new Document( 'geoname', 'venue', 1003 ) - .setAlpha3( 'GBR' ) .setMeta( 'author', 'peter' ) .setName( 'default', 'Hackney City Farm' ) .setName( 'alt', 'Haggerston City Farm' ) @@ -74,7 +73,6 @@ module.exports.tests.complete = function(test) { // data partitioning 'source': 'geoname', 'layer': 'venue', - 'alpha3': 'GBR', // place name (ngram analysis) 'name':{