From a65a192352814b59bc4bd5339e5f3e7d04ef7465 Mon Sep 17 00:00:00 2001 From: Taranveer Virk Date: Thu, 15 Feb 2018 01:55:34 -0500 Subject: [PATCH] test: fix failing test --- .../integration/controller.booter.integration.ts | 14 ++++++++------ .../test/unit/booters/controller.booter.unit.ts | 11 +++++++---- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/packages/boot/test/integration/controller.booter.integration.ts b/packages/boot/test/integration/controller.booter.integration.ts index c837532cad1c..805a8bd7ca0a 100644 --- a/packages/boot/test/integration/controller.booter.integration.ts +++ b/packages/boot/test/integration/controller.booter.integration.ts @@ -4,13 +4,17 @@ // License text available at https://opensource.org/licenses/MIT import {expect, TestSandbox} from '@loopback/testlab'; -import {CoreBindings} from '@loopback/core'; import {resolve} from 'path'; import {ControllerBooterApp} from '../fixtures/application'; describe('controller booter integration tests', () => { const SANDBOX_PATH = resolve(__dirname, '../../.sandbox'); const sandbox = new TestSandbox(SANDBOX_PATH); + + // Remnants from Refactor -- need to add these to core + const CONTROLLERS_PREFIX = 'controllers'; + const CONTROLLERS_TAG = 'controller'; + let app: ControllerBooterApp; beforeEach(resetSandbox); @@ -18,15 +22,13 @@ describe('controller booter integration tests', () => { it('boots controllers when app.boot() is called', async () => { const expectedBindings = [ - `${CoreBindings.CONTROLLERS_PREFIX}.ControllerOne`, - `${CoreBindings.CONTROLLERS_PREFIX}.ControllerTwo`, + `${CONTROLLERS_PREFIX}.ControllerOne`, + `${CONTROLLERS_PREFIX}.ControllerTwo`, ]; await app.boot(); - const bindings = app - .findByTag(CoreBindings.CONTROLLERS_TAG) - .map(b => b.key); + const bindings = app.findByTag(CONTROLLERS_TAG).map(b => b.key); expect(bindings.sort()).to.eql(expectedBindings.sort()); }); diff --git a/packages/boot/test/unit/booters/controller.booter.unit.ts b/packages/boot/test/unit/booters/controller.booter.unit.ts index 8ce98210ef85..30558f8b0e5d 100644 --- a/packages/boot/test/unit/booters/controller.booter.unit.ts +++ b/packages/boot/test/unit/booters/controller.booter.unit.ts @@ -4,7 +4,7 @@ // License text available at https://opensource.org/licenses/MIT import {expect, TestSandbox} from '@loopback/testlab'; -import {Application, CoreBindings} from '@loopback/core'; +import {Application} from '@loopback/core'; import {ControllerBooter, ControllerDefaults} from '../../../index'; import {resolve} from 'path'; @@ -12,6 +12,9 @@ describe('controller booter unit tests', () => { const SANDBOX_PATH = resolve(__dirname, '../../../.sandbox'); const sandbox = new TestSandbox(SANDBOX_PATH); + const CONTROLLERS_PREFIX = 'controllers'; + const CONTROLLERS_TAG = 'controller'; + let app: Application; beforeEach(resetSandbox); @@ -37,8 +40,8 @@ describe('controller booter unit tests', () => { it('binds controllers during load phase', async () => { const expected = [ - `${CoreBindings.CONTROLLERS_PREFIX}.ControllerOne`, - `${CoreBindings.CONTROLLERS_PREFIX}.ControllerTwo`, + `${CONTROLLERS_PREFIX}.ControllerOne`, + `${CONTROLLERS_PREFIX}.ControllerTwo`, ]; await sandbox.copyFile( resolve(__dirname, '../../fixtures/multiple.artifact.js'), @@ -50,7 +53,7 @@ describe('controller booter unit tests', () => { booterInst.discovered = [resolve(SANDBOX_PATH, 'multiple.artifact.js')]; await booterInst.load(); - const ctrls = app.findByTag(CoreBindings.CONTROLLERS_TAG); + const ctrls = app.findByTag(CONTROLLERS_TAG); const keys = ctrls.map(binding => binding.key); expect(keys).to.have.lengthOf(NUM_CLASSES); expect(keys.sort()).to.eql(expected.sort());