Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: move test files to `src/__tests__` in example apps #2316

Merged
merged 1 commit into from Feb 1, 2019
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.
+68 −71
Diff settings

Always

Just for now

@@ -7,7 +7,7 @@
"node": ">=8.9"
},
"scripts": {
"acceptance": "lb-mocha \"dist/test/acceptance/**/*.js\"",
"acceptance": "lb-mocha \"dist/__tests__/acceptance/**/*.js\"",
"build:apidocs": "lb-apidocs",
"build": "lb-tsc es2017 --outDir dist",
"build:watch": "lb-tsc es2017 --outDir dist --watch",
@@ -21,9 +21,9 @@
"tslint": "lb-tslint",
"tslint:fix": "npm run tslint -- --fix",
"pretest": "npm run clean && npm run build",
"test": "lb-mocha --allow-console-logs \"dist/test\"",
"test": "lb-mocha --allow-console-logs \"dist/__tests__/**/*.js\"",
"posttest": "npm run lint",
"test:dev": "lb-mocha --allow-console-logs dist/test/**/*.js && npm run posttest",
"test:dev": "lb-mocha --allow-console-logs dist/__tests__/**/*.js && npm run posttest",
"prestart": "npm run build",
"start": "node ."
},
@@ -9,7 +9,7 @@ import {
expect,
givenHttpServerConfig,
} from '@loopback/testlab';
import {HelloWorldApplication} from '../../src/application';
import {HelloWorldApplication} from '../../application';

describe('Application', () => {
let app: HelloWorldApplication;
@@ -2,7 +2,7 @@
"$schema": "http://json.schemastore.org/tsconfig",
"extends": "@loopback/build/config/tsconfig.common.json",
"compilerOptions": {
"rootDir": "."
"rootDir": "src"
},
"include": ["index.ts", "src", "test"]
"include": ["src"]
}
@@ -19,9 +19,9 @@
"tslint": "lb-tslint",
"tslint:fix": "npm run tslint -- --fix",
"pretest": "npm run clean && npm run build",
"test": "lb-mocha \"dist/test/unit/**/*.js\" \"dist/test/acceptance/**/*.js\"",
"test": "lb-mocha \"dist/__tests__/**/*.js\"",
"posttest": "npm run lint",
"test:dev": "lb-mocha --allow-console-logs dist/test/**/*.js && npm run posttest",
"test:dev": "lb-mocha --allow-console-logs dist/__tests__/**/*.js && npm run posttest",
"verify": "npm pack && tar xf *example-log-extension*.tgz && tree package && npm run clean"
},
"repository": {
@@ -2,7 +2,7 @@
"$schema": "http://json.schemastore.org/tsconfig",
"extends": "@loopback/build/config/tsconfig.common.json",
"compilerOptions": {
"rootDir": "."
"rootDir": "src"
},
"include": ["index.ts", "src", "test"]
"include": ["src"]
}
@@ -22,9 +22,9 @@
"tslint": "lb-tslint",
"tslint:fix": "npm run tslint -- --fix",
"pretest": "npm run clean && npm run build",
"test": "lb-mocha dist/test",
"test": "lb-mocha dist/__tests__/**/*.js",
"posttest": "npm run lint",
"test:dev": "lb-mocha --allow-console-logs dist/test/**/*.js && npm run posttest",
"test:dev": "lb-mocha --allow-console-logs dist/__tests__/**/*.js && npm run posttest",
"prestart": "npm run build",
"start": "node ."
},
@@ -3,7 +3,7 @@
// This file is licensed under the MIT License.
// License text available at https://opensource.org/licenses/MIT

import {GreetController} from '../../../src/controllers';
import {GreetController} from '../../../controllers';
import {expect} from '@loopback/testlab';

describe('greet.controller', () => {
@@ -4,8 +4,8 @@
// License text available at https://opensource.org/licenses/MIT

import * as express from 'express';
import {RPCServer} from '../../src/rpc.server';
import {routeHandler} from '../../src/rpc.router';
import {RPCServer} from '../../rpc.server';
import {routeHandler} from '../../rpc.router';
import {expect, sinon} from '@loopback/testlab';

describe('rpcRouter', () => {
@@ -26,9 +26,9 @@
"tslint": "lb-tslint",
"tslint:fix": "npm run tslint -- --fix",
"pretest": "npm run clean && npm run build",
"test": "lb-mocha \"dist/test\"",
"test": "lb-mocha \"dist/__tests__/**/*.js\"",
"posttest": "npm run lint",
"test:dev": "lb-mocha --allow-console-logs dist/test/**/*.js && npm run posttest",
"test:dev": "lb-mocha --allow-console-logs dist/__tests__/**/*.js && npm run posttest",
"prestart": "npm run build",
"start": "node ."
},
@@ -1,5 +1,5 @@
import {Client, createRestAppClient, expect} from '@loopback/testlab';
import {SoapCalculatorApplication} from '../../src/application';
import {SoapCalculatorApplication} from '../../application';

describe('Application', function() {
let app: SoapCalculatorApplication;
@@ -1,4 +1,4 @@
import {CalculatorDataSource} from '../src/datasources/calculator.datasource';
import {CalculatorDataSource} from '../datasources/calculator.datasource';

export async function givenAConnectedDataSource(): Promise<
CalculatorDataSource
@@ -1,8 +1,8 @@
import {
CalculatorService,
CalculatorParameters,
} from '../../../src/services/calculator.service';
import {CalculatorServiceProvider} from '../../../src/services/calculator.service';
} from '../../../services/calculator.service';
import {CalculatorServiceProvider} from '../../../services/calculator.service';
import {givenAConnectedDataSource} from '../../helpers';

import {expect} from '@loopback/testlab';
@@ -17,7 +17,7 @@ export class SoapCalculatorApplication extends BootMixin(
this.sequence(MySequence);

// Set up default home page
this.static('/', path.join(__dirname, '../../public'));
this.static('/', path.join(__dirname, '../public'));

this.component(RestExplorerComponent);

@@ -2,7 +2,7 @@
"$schema": "http://json.schemastore.org/tsconfig",
"extends": "@loopback/build/config/tsconfig.common.json",
"compilerOptions": {
"rootDir": "."
"rootDir": "src"
},
"include": ["index.ts", "src", "test"]
"include": ["src"]
}
@@ -19,8 +19,8 @@
"tslint": "lb-tslint",
"tslint:fix": "npm run tslint -- --fix",
"pretest": "npm run build",
"test": "lb-mocha \"dist/test/*/**/*.js\"",
"test:dev": "lb-mocha --allow-console-logs dist/test/**/*.js && npm run posttest",
"test": "lb-mocha \"dist/__tests__/**/*.js\"",
"test:dev": "lb-mocha --allow-console-logs dist/__tests__/**/*.js && npm run posttest",
"verify": "npm pack && tar xf loopback-todo-list*.tgz && tree package && npm run clean",
"migrate": "node ./dist/src/migrate",
"prestart": "npm run build",
@@ -10,12 +10,9 @@ import {
givenHttpServerConfig,
toJSON,
} from '@loopback/testlab';
import {TodoListApplication} from '../../src/application';
import {TodoList, TodoListImage} from '../../src/models/';
import {
TodoListRepository,
TodoListImageRepository,
} from '../../src/repositories/';
import {TodoListApplication} from '../../application';
import {TodoList, TodoListImage} from '../../models/';
import {TodoListRepository, TodoListImageRepository} from '../../repositories/';
import {givenTodoListImage, givenTodoList} from '../helpers';

describe('TodoListApplication', () => {
@@ -10,9 +10,9 @@ import {
givenHttpServerConfig,
toJSON,
} from '@loopback/testlab';
import {TodoListApplication} from '../../src/application';
import {Todo, TodoList} from '../../src/models/';
import {TodoListRepository, TodoRepository} from '../../src/repositories/';
import {TodoListApplication} from '../../application';
import {Todo, TodoList} from '../../models/';
import {TodoListRepository, TodoRepository} from '../../repositories/';
import {givenTodo, givenTodoList} from '../helpers';

describe('TodoListApplication', () => {
@@ -11,9 +11,9 @@ import {
givenHttpServerConfig,
toJSON,
} from '@loopback/testlab';
import {TodoListApplication} from '../../src/application';
import {TodoList} from '../../src/models/';
import {TodoListRepository} from '../../src/repositories/';
import {TodoListApplication} from '../../application';
import {TodoList} from '../../models/';
import {TodoListRepository} from '../../repositories/';
import {givenTodoList} from '../helpers';

describe('TodoListApplication', () => {
@@ -11,9 +11,9 @@ import {
givenHttpServerConfig,
toJSON,
} from '@loopback/testlab';
import {TodoListApplication} from '../../src/application';
import {Todo, TodoList} from '../../src/models/';
import {TodoRepository, TodoListRepository} from '../../src/repositories/';
import {TodoListApplication} from '../../application';
import {Todo, TodoList} from '../../models/';
import {TodoRepository, TodoListRepository} from '../../repositories/';
import {givenTodo, givenTodoList} from '../helpers';

describe('TodoListApplication', () => {
@@ -3,7 +3,7 @@
// This file is licensed under the MIT License.
// License text available at https://opensource.org/licenses/MIT

import {Todo, TodoList, TodoListImage} from '../src/models';
import {Todo, TodoList, TodoListImage} from '../models';

/*
==============================================================================
@@ -13,9 +13,9 @@ import {
sinon,
StubbedInstanceWithSinonAccessor,
} from '@loopback/testlab';
import {TodoListTodoController} from '../../../src/controllers';
import {Todo, TodoList} from '../../../src/models';
import {TodoListRepository} from '../../../src/repositories';
import {TodoListTodoController} from '../../../controllers';
import {Todo, TodoList} from '../../../models';
import {TodoListRepository} from '../../../repositories';
import {givenTodo, givenTodoList} from '../../helpers';

describe('TodoController', () => {
@@ -9,9 +9,9 @@ import {
sinon,
StubbedInstanceWithSinonAccessor,
} from '@loopback/testlab';
import {TodoListController} from '../../../src/controllers';
import {TodoList} from '../../../src/models';
import {TodoListRepository} from '../../../src/repositories';
import {TodoListController} from '../../../controllers';
import {TodoList} from '../../../models';
import {TodoListRepository} from '../../../repositories';
import {givenTodoList} from '../../helpers';

describe('TodoController', () => {
@@ -9,9 +9,9 @@ import {
sinon,
StubbedInstanceWithSinonAccessor,
} from '@loopback/testlab';
import {TodoController} from '../../../src/controllers';
import {Todo} from '../../../src/models';
import {TodoRepository} from '../../../src/repositories';
import {TodoController} from '../../../controllers';
import {Todo} from '../../../models';
import {TodoRepository} from '../../../repositories';
import {givenTodo} from '../../helpers';

describe('TodoController', () => {
@@ -21,7 +21,7 @@ export class TodoListApplication extends BootMixin(
this.sequence(MySequence);

// Set up default home page
this.static('/', path.join(__dirname, '../../public'));
this.static('/', path.join(__dirname, '../public'));

this.component(RestExplorerComponent);

@@ -4,5 +4,5 @@
"compilerOptions": {
"rootDir": "."
},
"include": ["index.ts", "src", "test"]
"include": ["src"]
}
Copy path View file
@@ -19,8 +19,8 @@
"tslint": "lb-tslint",
"tslint:fix": "npm run tslint -- --fix",
"pretest": "npm run build",
"test": "lb-mocha \"dist/test/*/**/*.js\"",
"test:dev": "lb-mocha --allow-console-logs dist/test/**/*.js && npm run posttest",
"test": "lb-mocha \"dist/__tests__/**/*.js\"",
"test:dev": "lb-mocha --allow-console-logs dist/__tests__/**/*.js && npm run posttest",
"verify": "npm pack && tar xf loopback-todo*.tgz && tree package && npm run clean",
"migrate": "node ./dist/src/migrate",
"prestart": "npm run build",
@@ -11,9 +11,9 @@ import {
givenHttpServerConfig,
toJSON,
} from '@loopback/testlab';
import {TodoListApplication} from '../../src/application';
import {Todo} from '../../src/models/';
import {TodoRepository} from '../../src/repositories/';
import {TodoListApplication} from '../../application';
import {Todo} from '../../models/';
import {TodoRepository} from '../../repositories/';
import {
aLocation,
getProxiedGeoCoderConfig,
@@ -6,9 +6,9 @@
import {HttpCachingProxy} from '@loopback/http-caching-proxy';
import {merge} from 'lodash';
import * as path from 'path';
import {Todo} from '../src/models/index';
import {GeoPoint} from '../src/services/geocoder.service';
import * as GEO_CODER_CONFIG from '../src/datasources/geocoder.datasource.json';
import {Todo} from '../models/index';
import {GeoPoint} from '../services/geocoder.service';
import * as GEO_CODER_CONFIG from '../datasources/geocoder.datasource.json';

/*
==============================================================================
@@ -4,13 +4,13 @@
// License text available at https://opensource.org/licenses/MIT

import {expect} from '@loopback/testlab';
import {GeocoderService, GeocoderServiceProvider} from '../../../src/services';
import {GeocoderService, GeocoderServiceProvider} from '../../../services';
import {
HttpCachingProxy,
givenCachingProxy,
getProxiedGeoCoderConfig,
} from '../../helpers';
import {GeocoderDataSource} from '../../../src/datasources/geocoder.datasource';
import {GeocoderDataSource} from '../../../datasources/geocoder.datasource';

describe('GeoLookupService', function() {
// tslint:disable-next-line:no-invalid-this
@@ -10,10 +10,10 @@ import {
sinon,
StubbedInstanceWithSinonAccessor,
} from '@loopback/testlab';
import {TodoController} from '../../../src/controllers';
import {Todo} from '../../../src/models/index';
import {TodoRepository} from '../../../src/repositories';
import {GeocoderService} from '../../../src/services';
import {TodoController} from '../../../controllers';
import {Todo} from '../../../models/index';
import {TodoRepository} from '../../../repositories';
import {GeocoderService} from '../../../services';
import {aLocation, givenTodo} from '../../helpers';

describe('TodoController', () => {
@@ -22,7 +22,7 @@ export class TodoListApplication extends BootMixin(
this.sequence(MySequence);

// Set up default home page
this.static('/', path.join(__dirname, '../../public'));
this.static('/', path.join(__dirname, '../public'));

this.component(RestExplorerComponent);

@@ -2,7 +2,7 @@
"$schema": "http://json.schemastore.org/tsconfig",
"extends": "@loopback/build/config/tsconfig.common.json",
"compilerOptions": {
"rootDir": "."
"rootDir": "src"
},
"include": ["index.ts", "src", "test"]
"include": ["src"]
}
Copy path View file
@@ -50,7 +50,7 @@
"test:ci": "node packages/build/bin/run-nyc npm run mocha --scripts-prepend-node-path",
"verify:docs": "npm run build:site -- --verify",
"build:site": "./bin/build-docs-site.sh",
"mocha": "node packages/build/bin/run-mocha \"packages/*/dist/test/**/*.js\" \"packages/*/dist/__tests__/**/*.js\" \"examples/*/dist/test/**/*.js\" \"packages/cli/test/**/*.js\" \"packages/build/test/*/*.js\"",
"mocha": "node packages/build/bin/run-mocha \"packages/*/dist/test/**/*.js\" \"packages/*/dist/__tests__/**/*.js\" \"examples/*/dist/__tests__/**/*.js\" \"packages/cli/test/**/*.js\" \"packages/build/test/*/*.js\"",
"posttest": "npm run lint"
},
"config": {
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.