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

Rename CrudConnectorFeatures to CrudFeatures #3411

Merged
merged 2 commits into from
Jul 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
// This file is licensed under the MIT License.
// License text available at https://opensource.org/licenses/MIT

import {
CrudConnectorFeatures,
DataSourceOptions,
} from '@loopback/repository-tests';
import {CrudFeatures, DataSourceOptions} from '@loopback/repository-tests';

const connector = require('loopback-connector-mongodb');

Expand All @@ -17,6 +14,6 @@ export const MONGODB_CONFIG: DataSourceOptions = {
database: process.env.MONGODB_DATABASE || 'repository-tests',
};

export const MONGODB_FEATURES: Partial<CrudConnectorFeatures> = {
export const MONGODB_FEATURES: Partial<CrudFeatures> = {
idType: 'string',
};
7 changes: 2 additions & 5 deletions acceptance/repository-mysql/src/__tests__/mysql.datasource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
// This file is licensed under the MIT License.
// License text available at https://opensource.org/licenses/MIT

import {
CrudConnectorFeatures,
DataSourceOptions,
} from '@loopback/repository-tests';
import {CrudFeatures, DataSourceOptions} from '@loopback/repository-tests';

const connector = require('loopback-connector-mysql');

Expand All @@ -20,7 +17,7 @@ export const MYSQL_CONFIG: DataSourceOptions = {
createDatabase: true,
};

export const MYSQL_FEATURES: Partial<CrudConnectorFeatures> = {
export const MYSQL_FEATURES: Partial<CrudFeatures> = {
idType: 'number',
freeFormProperties: false,
};
8 changes: 4 additions & 4 deletions packages/repository-tests/src/crud-test-suite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import * as fs from 'fs';
import * as path from 'path';
import {withCrudCtx} from './helpers.repository-tests';
import {
CrudConnectorFeatures,
CrudFeatures,
CrudRepositoryCtor,
CrudTestContext,
DataSourceOptions,
Expand All @@ -20,15 +20,15 @@ const debug = debugFactory('loopback:repository-tests');
type SuiteFn = (
dataSourceOptions: DataSourceOptions,
repositoryClass: CrudRepositoryCtor,
connectorFeatures: CrudConnectorFeatures,
connectorFeatures: CrudFeatures,
) => void;

export function crudRepositoryTestSuite(
dataSourceOptions: DataSourceOptions,
repositoryClass: CrudRepositoryCtor,
connectorFeatures: Partial<CrudConnectorFeatures>,
connectorFeatures: Partial<CrudFeatures>,
) {
const features: CrudConnectorFeatures = {
const features: CrudFeatures = {
idType: 'string',
freeFormProperties: true,
...connectorFeatures,
Expand Down
4 changes: 2 additions & 2 deletions packages/repository-tests/src/crud/create-retrieve.suite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {EntityCrudRepository} from '@loopback/repository/src';
import {expect, toJSON} from '@loopback/testlab';
import {withCrudCtx} from '../helpers.repository-tests';
import {
CrudConnectorFeatures,
CrudFeatures,
CrudRepositoryCtor,
CrudTestContext,
DataSourceOptions,
Expand All @@ -19,7 +19,7 @@ import {
export function createRetrieveSuite(
dataSourceOptions: DataSourceOptions,
repositoryClass: CrudRepositoryCtor,
connectorFeatures: CrudConnectorFeatures,
connectorFeatures: CrudFeatures,
) {
@model()
class Product extends Entity {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {expect, skipIf, toJSON} from '@loopback/testlab';
import {Suite} from 'mocha';
import {withCrudCtx} from '../helpers.repository-tests';
import {
CrudConnectorFeatures,
CrudFeatures,
CrudRepositoryCtor,
CrudTestContext,
DataSourceOptions,
Expand All @@ -18,7 +18,7 @@ import {
export function freeformPropertiesSuite(
dataSourceOptions: DataSourceOptions,
repositoryClass: CrudRepositoryCtor,
connectorFeatures: CrudConnectorFeatures,
connectorFeatures: CrudFeatures,
) {
skipIf<[(this: Suite) => void], void>(
!connectorFeatures.freeFormProperties,
Expand Down
10 changes: 5 additions & 5 deletions packages/repository-tests/src/types.repository-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ import {
export type DataSourceOptions = Options;

/**
* List of flags describing connector-specific behavior. These flags
* are used by the test suite to tweak assertions and skip tests
* for scenarios not supported by some connectors.
* List of flags describing behavior specific to different connectors and
* repository implementations. These flags are used by the test suite to tweak
* assertions and skip tests for scenarios not supported by some implementations.
*/
export interface CrudConnectorFeatures {
export interface CrudFeatures {
/**
* What type is used for auto-generated primary keys?
* - SQL databases typically use auto-incremented numbers,
Expand Down Expand Up @@ -60,6 +60,6 @@ export type CrudRepositoryCtor = new <
export interface CrudTestContext {
dataSourceOptions: DataSourceOptions;
repositoryClass: CrudRepositoryCtor;
connectorFeatures: CrudConnectorFeatures;
connectorFeatures: CrudFeatures;
dataSource: juggler.DataSource;
}
2 changes: 2 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
{
"extends": "./packages/build/config/tsconfig.common.json",
"include": [
"acceptance",
"benchmark",
"examples",
"packages"
],
"exclude": [
"node_modules/**",
"acceptance/node_modules/**",
"benchmark/node_modules/**",
"examples/*/node_modules/**",
"packages/*/node_modules/**",
Expand Down