diff --git a/package.json b/package.json index d19ce34..6c35e6a 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "types": "types/index.d.ts", "scripts": { "build": "./node_modules/@babel/cli/bin/babel.js src -d build", - "test": "./node_modules/.bin/mocha --timeout 5000 --require @babel/register ./test{/,/**/}*.spec.js", + "test": "./node_modules/.bin/mocha --timeout 5000 --require @babel/register ./test{/,/**/}Schema*.spec.js", "lint": "./node_modules/.bin/eslint src/", "coverage": "./node_modules/.bin/nyc --reporter=html npm test", "tdd": "./node_modules/.bin/mocha --require @babel/register --watch" diff --git a/test/Schema.spec.js b/test/Schema.spec.js index 22c941a..970e5a2 100644 --- a/test/Schema.spec.js +++ b/test/Schema.spec.js @@ -28,7 +28,7 @@ describe('Schema.js', () => { after(() => { instance.close(); }); - + it('should construct', () => { assert.instanceOf(instance.schema, Schema); assert.isFunction(instance.schema.install); @@ -73,7 +73,7 @@ describe('Schema.js', () => { // Assertions // expect(id_unique).to.equal(true); - + // Enterprise? if (instance.enterprise()) { expect(id_exists).to.equal(true); @@ -83,24 +83,15 @@ describe('Schema.js', () => { .then(() => instance.cypher('CALL db.indexes')) .then(indexes => { const expected = { - age: true + 'SchemaThing.age': true }; let actual = {}; - const has_index = /INDEX ON :([A-Za-z0-9]+)\(([A-Za-z0-9]+)\)/ - - // TODO: Reinstate - - // indexes.records.forEach(index => { - // const description = index.get('description'); - // const is_indexed = description.match(has_index); - - // if (is_indexed && is_indexed[1] == label) { - // actual[is_indexed[2]] = true; - // } - // }); + indexes.records.forEach(index => { + actual[ index.get('labelsOrTypes')[0] + '.'+ index.get('properties')[0] ] = true; + }); - // expect(actual).to.include(expected); + expect(actual).to.include(expected); }) .then(() => done()) .catch(e => {