Skip to content

Commit

Permalink
feat(integration): merge elastictest into this module
Browse files Browse the repository at this point in the history
  • Loading branch information
missinglink committed Mar 11, 2024
1 parent 01d908c commit 05901a9
Show file tree
Hide file tree
Showing 20 changed files with 180 additions and 76 deletions.
6 changes: 3 additions & 3 deletions integration/address_matching.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// validate analyzer is behaving as expected

const elastictest = require('elastictest');
const Suite = require('../test/elastictest/Suite');
const config = require('pelias-config').generate();
const getTotalHits = require('./_hits_total_helper');

Expand All @@ -9,7 +9,7 @@ module.exports.tests = {};
module.exports.tests.functional = function(test, common){
test( 'functional', function(t){

var suite = new elastictest.Suite( common.clientOpts, common.create );
var suite = new Suite( common.clientOpts, common.create );
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up

// index some docs
Expand Down Expand Up @@ -204,7 +204,7 @@ module.exports.tests.venue_vs_address = function(test, common){
// Unfortunately there seems to be no easy way of fixing this, it's an artifact of us
// storing the street names in the name.default field.

var suite = new elastictest.Suite( common.clientOpts, common.create );
var suite = new Suite( common.clientOpts, common.create );
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up

// index a venue
Expand Down
8 changes: 4 additions & 4 deletions integration/admin_abbreviations.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const elastictest = require('elastictest');
const Suite = require('../test/elastictest/Suite');
const config = require('pelias-config').generate();
const getTotalHits = require('./_hits_total_helper');

Expand All @@ -12,7 +12,7 @@ module.exports.tests = {};
module.exports.tests.synonyms = function (test, common) {
test('synonyms - alpha3 does not share a prefix with alpha2', function (t) {

var suite = new elastictest.Suite(common.clientOpts, common.create);
var suite = new Suite(common.clientOpts, common.create);
suite.action(done => setTimeout(done, 500)); // wait for es to bring some shards up

// index document 1 with country_a='MEX'
Expand Down Expand Up @@ -134,7 +134,7 @@ module.exports.tests.synonyms = function (test, common) {

test('synonyms - alpha3 shares a prefix with alpha2', function (t) {

var suite = new elastictest.Suite(common.clientOpts, common.create);
var suite = new Suite(common.clientOpts, common.create);
suite.action(done => setTimeout(done, 500)); // wait for es to bring some shards up

// index document 1 with country_a='NZL'
Expand Down Expand Up @@ -256,7 +256,7 @@ module.exports.tests.synonyms = function (test, common) {

test('synonyms - additional synonyms do not increase field length', function (t) {

var suite = new elastictest.Suite(common.clientOpts, common.create);
var suite = new Suite(common.clientOpts, common.create);
suite.action(done => setTimeout(done, 500)); // wait for es to bring some shards up

// index document 1 with country_a='NZL'
Expand Down
4 changes: 2 additions & 2 deletions integration/admin_matching.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// validate analyzer is behaving as expected

const elastictest = require('elastictest');
const Suite = require('../test/elastictest/Suite');
const config = require('pelias-config').generate();
const getTotalHits = require('./_hits_total_helper');

Expand All @@ -9,7 +9,7 @@ module.exports.tests = {};
module.exports.tests.functional = function(test, common){
test( 'functional', function(t){

var suite = new elastictest.Suite( common.clientOpts, common.create );
var suite = new Suite( common.clientOpts, common.create );
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up

// index a document with all admin values
Expand Down
12 changes: 6 additions & 6 deletions integration/analyzer_peliasAdmin.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
// validate analyzer is behaving as expected

var tape = require('tape'),
elastictest = require('elastictest'),
Suite = require('../test/elastictest/Suite'),
punctuation = require('../punctuation');

module.exports.tests = {};

module.exports.tests.analyze = function(test, common){
test( 'analyze', function(t){

var suite = new elastictest.Suite( common.clientOpts, common.create );
var suite = new Suite( common.clientOpts, common.create );
var assertAnalysis = common.analyze.bind( null, suite, t, 'peliasAdmin' );
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up

Expand All @@ -33,7 +33,7 @@ module.exports.tests.analyze = function(test, common){
module.exports.tests.functional = function(test, common){
test( 'functional', function(t){

var suite = new elastictest.Suite( common.clientOpts, common.create );
var suite = new Suite( common.clientOpts, common.create );
var assertAnalysis = common.analyze.bind( null, suite, t, 'peliasAdmin' );
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up

Expand Down Expand Up @@ -71,7 +71,7 @@ module.exports.tests.functional = function(test, common){
module.exports.tests.synonyms = function(test, common){
test( 'synonyms', function(t){

var suite = new elastictest.Suite( common.clientOpts, common.create );
var suite = new Suite( common.clientOpts, common.create );
var assertAnalysis = common.analyze.bind( null, suite, t, 'peliasAdmin' );
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up

Expand All @@ -98,7 +98,7 @@ module.exports.tests.synonyms = function(test, common){
module.exports.tests.tokenizer = function(test, common){
test( 'tokenizer', function(t){

var suite = new elastictest.Suite( common.clientOpts, common.create );
var suite = new Suite( common.clientOpts, common.create );
var assertAnalysis = common.analyze.bind( null, suite, t, 'peliasAdmin' );
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up

Expand Down Expand Up @@ -126,7 +126,7 @@ module.exports.tests.tokenizer = function(test, common){
module.exports.tests.unicode = function(test, common){
test( 'normalization', function(t){

var suite = new elastictest.Suite( common.clientOpts, common.create );
var suite = new Suite( common.clientOpts, common.create );
var assertAnalysis = common.analyze.bind( null, suite, t, 'peliasAdmin' );
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up

Expand Down
6 changes: 3 additions & 3 deletions integration/analyzer_peliasHousenumber.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
// validate analyzer is behaving as expected

var tape = require('tape'),
elastictest = require('elastictest'),
Suite = require('../test/elastictest/Suite'),
punctuation = require('../punctuation');

module.exports.tests = {};

module.exports.tests.analyze = function(test, common){
test( 'analyze', function(t){

var suite = new elastictest.Suite( common.clientOpts, common.create );
var suite = new Suite( common.clientOpts, common.create );
var assertAnalysis = common.analyze.bind( null, suite, t, 'peliasHousenumber' );
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up

Expand All @@ -23,7 +23,7 @@ module.exports.tests.analyze = function(test, common){
module.exports.tests.functional = function(test, common){
test( 'functional', function(t){

var suite = new elastictest.Suite( common.clientOpts, common.create );
var suite = new Suite( common.clientOpts, common.create );
var assertAnalysis = common.analyze.bind( null, suite, t, 'peliasHousenumber' );
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up

Expand Down
16 changes: 8 additions & 8 deletions integration/analyzer_peliasIndexOneEdgeGram.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
// validate analyzer is behaving as expected

var tape = require('tape'),
elastictest = require('elastictest'),
Suite = require('../test/elastictest/Suite'),
punctuation = require('../punctuation');

module.exports.tests = {};

module.exports.tests.analyze = function(test, common){
test( 'analyze', function(t){

var suite = new elastictest.Suite( common.clientOpts, common.create );
var suite = new Suite( common.clientOpts, common.create );
var assertAnalysis = common.analyze.bind( null, suite, t, 'peliasIndexOneEdgeGram' );
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up

Expand Down Expand Up @@ -95,7 +95,7 @@ module.exports.tests.analyze = function(test, common){
module.exports.tests.address_suffix_expansions = function(test, common){
test( 'address suffix expansions', function(t){

var suite = new elastictest.Suite( common.clientOpts, common.create );
var suite = new Suite( common.clientOpts, common.create );
var assertAnalysis = common.analyze.bind( null, suite, t, 'peliasIndexOneEdgeGram' );
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up

Expand Down Expand Up @@ -125,7 +125,7 @@ module.exports.tests.address_suffix_expansions = function(test, common){
module.exports.tests.stop_words = function(test, common){
test( 'stop words', function(t){

var suite = new elastictest.Suite( common.clientOpts, common.create );
var suite = new Suite( common.clientOpts, common.create );
var assertAnalysis = common.analyze.bind( null, suite, t, 'peliasIndexOneEdgeGram' );
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up

Expand All @@ -146,7 +146,7 @@ module.exports.tests.stop_words = function(test, common){
module.exports.tests.functional = function(test, common){
test( 'functional', function(t){

var suite = new elastictest.Suite( common.clientOpts, common.create );
var suite = new Suite( common.clientOpts, common.create );
var assertAnalysis = common.analyze.bind( null, suite, t, 'peliasIndexOneEdgeGram' );
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up

Expand All @@ -172,7 +172,7 @@ module.exports.tests.functional = function(test, common){
module.exports.tests.unique = function(test, common){
test( 'unique', function(t){

var suite = new elastictest.Suite( common.clientOpts, common.create );
var suite = new Suite( common.clientOpts, common.create );
var assertAnalysis = common.analyze.bind( null, suite, t, 'peliasIndexOneEdgeGram' );
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up

Expand All @@ -186,7 +186,7 @@ module.exports.tests.unique = function(test, common){
module.exports.tests.address = function(test, common){
test( 'address', function(t){

var suite = new elastictest.Suite( common.clientOpts, common.create );
var suite = new Suite( common.clientOpts, common.create );
var assertAnalysis = common.analyze.bind( null, suite, t, 'peliasIndexOneEdgeGram' );
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up

Expand Down Expand Up @@ -218,7 +218,7 @@ module.exports.tests.address = function(test, common){
module.exports.tests.unicode = function(test, common){
test( 'normalization', function(t){

var suite = new elastictest.Suite( common.clientOpts, common.create );
var suite = new Suite( common.clientOpts, common.create );
var assertAnalysis = common.analyze.bind( null, suite, t, 'peliasIndexOneEdgeGram' );
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up

Expand Down
16 changes: 8 additions & 8 deletions integration/analyzer_peliasPhrase.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// validate analyzer is behaving as expected

const elastictest = require('elastictest');
const Suite = require('../test/elastictest/Suite');
const punctuation = require('../punctuation');
const config = require('pelias-config').generate();
const getTotalHits = require('./_hits_total_helper');
Expand All @@ -10,7 +10,7 @@ module.exports.tests = {};
module.exports.tests.analyze = function(test, common){
test( 'analyze', function(t){

var suite = new elastictest.Suite( common.clientOpts, common.create );
var suite = new Suite( common.clientOpts, common.create );
var assertAnalysis = common.analyze.bind( null, suite, t, 'peliasPhrase' );
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up

Expand Down Expand Up @@ -62,7 +62,7 @@ module.exports.tests.analyze = function(test, common){
module.exports.tests.functional = function(test, common){
test( 'functional', function(t){

var suite = new elastictest.Suite( common.clientOpts, common.create );
var suite = new Suite( common.clientOpts, common.create );
var assertAnalysis = common.analyze.bind( null, suite, t, 'peliasPhrase' );
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up

Expand Down Expand Up @@ -109,7 +109,7 @@ module.exports.tests.functional = function(test, common){
module.exports.tests.tokenizer = function(test, common){
test( 'tokenizer', function(t){

var suite = new elastictest.Suite( common.clientOpts, common.create );
var suite = new Suite( common.clientOpts, common.create );
var assertAnalysis = common.analyze.bind( null, suite, t, 'peliasPhrase' );
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up

Expand All @@ -135,7 +135,7 @@ module.exports.tests.tokenizer = function(test, common){
module.exports.tests.slop = function(test, common){
test( 'slop', function(t){

var suite = new elastictest.Suite( common.clientOpts, common.create );
var suite = new Suite( common.clientOpts, common.create );
var assertAnalysis = common.analyze.bind( null, suite, t, 'peliasPhrase' );
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up

Expand All @@ -153,7 +153,7 @@ module.exports.tests.slop = function(test, common){
module.exports.tests.slop_query = function(test, common){
test( 'slop query', function(t){

var suite = new elastictest.Suite( common.clientOpts, common.create );
var suite = new Suite( common.clientOpts, common.create );
var assertAnalysis = common.analyze.bind( null, suite, t, 'peliasPhrase' );
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up

Expand Down Expand Up @@ -246,7 +246,7 @@ module.exports.tests.slop_query = function(test, common){
module.exports.tests.slop = function(test, common){
test( 'slop', function(t){

var suite = new elastictest.Suite( common.clientOpts, common.create );
var suite = new Suite( common.clientOpts, common.create );
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up

// index a document
Expand Down Expand Up @@ -288,7 +288,7 @@ module.exports.tests.slop = function(test, common){
module.exports.tests.unicode = function(test, common){
test( 'normalization', function(t){

var suite = new elastictest.Suite( common.clientOpts, common.create );
var suite = new Suite( common.clientOpts, common.create );
var assertAnalysis = common.analyze.bind( null, suite, t, 'peliasPhrase' );
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up

Expand Down
10 changes: 5 additions & 5 deletions integration/analyzer_peliasQuery.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
// validate analyzer is behaving as expected

var tape = require('tape'),
elastictest = require('elastictest'),
Suite = require('../test/elastictest/Suite'),
punctuation = require('../punctuation');

module.exports.tests = {};

module.exports.tests.analyze = function(test, common){
test( 'analyze', function(t){

var suite = new elastictest.Suite( common.clientOpts, common.create );
var suite = new Suite( common.clientOpts, common.create );
var assertAnalysis = common.analyze.bind( null, suite, t, 'peliasQuery' );
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up

Expand Down Expand Up @@ -41,7 +41,7 @@ module.exports.tests.analyze = function(test, common){
module.exports.tests.functional = function(test, common){
test( 'functional', function(t){

var suite = new elastictest.Suite( common.clientOpts, common.create );
var suite = new Suite( common.clientOpts, common.create );
var assertAnalysis = common.analyze.bind( null, suite, t, 'peliasQuery' );
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up

Expand All @@ -56,7 +56,7 @@ module.exports.tests.functional = function(test, common){
module.exports.tests.address = function(test, common){
test( 'address', function(t){

var suite = new elastictest.Suite( common.clientOpts, common.create );
var suite = new Suite( common.clientOpts, common.create );
var assertAnalysis = common.analyze.bind( null, suite, t, 'peliasQuery' );
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up

Expand All @@ -80,7 +80,7 @@ module.exports.tests.address = function(test, common){
module.exports.tests.unicode = function(test, common){
test( 'normalization', function(t){

var suite = new elastictest.Suite( common.clientOpts, common.create );
var suite = new Suite( common.clientOpts, common.create );
var assertAnalysis = common.analyze.bind( null, suite, t, 'peliasQuery' );
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up

Expand Down
Loading

0 comments on commit 05901a9

Please sign in to comment.