Skip to content

Commit

Permalink
fixup commented out tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bradbanister committed Nov 6, 2023
1 parent 4a3cd53 commit b942c70
Show file tree
Hide file tree
Showing 7 changed files with 269 additions and 492 deletions.
1 change: 0 additions & 1 deletion Meadowlark-js/packages/meadowlark-core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export type { QueryHandlerPlugin } from './plugin/backend/QueryHandlerPlugin';
export { NoQueryHandlerPlugin } from './plugin/backend/NoQueryHandlerPlugin';
export type { SystemTestClient, SystemTestablePlugin } from './plugin/backend/SystemTestablePlugin';
export { Subscribe } from './plugin/listener/Subscribe';
// export * as PluginLoader from './plugin/PluginLoader';

// Messages
export type { GetResult } from './message/GetResult';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export async function queryValidation({ frontendRequest, frontendResponse }: Mid
const removeDisallowedQueryParameters = R.omit(['offset', 'limit', 'totalCount']);
const queryParameters = removeDisallowedQueryParameters(frontendRequest.queryParameters);

const { errorBody } = await validateQueryString(queryParameters, frontendRequest.middleware.resourceSchema);
const { errorBody } = validateQueryString(queryParameters, frontendRequest.middleware.resourceSchema);

if (errorBody != null) {
const statusCode = 400;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export type QueryStringValidationResult = {
/**
* Validates that those queryParameters which are present are actually fields on the API resource
*/
function validateQueryParameters(resourceSchema: ResourceSchema, queryParameters: FrontendQueryParameters): string[] {
export function validateQueryParameters(resourceSchema: ResourceSchema, queryParameters: FrontendQueryParameters): string[] {
const { queryValidator } = getSchemaValidatorsFor(resourceSchema);

let errors: string[] = [];
Expand Down Expand Up @@ -69,10 +69,10 @@ function validateQueryParameters(resourceSchema: ResourceSchema, queryParameters
/**
* Validates that the query string keys are actually fields on the API resource.
*/
export async function validateQueryString(
export function validateQueryString(
queryStrings: FrontendQueryParameters,
resourceSchema: ResourceSchema,
): Promise<QueryStringValidationResult> {
): QueryStringValidationResult {
const bodyValidation: string[] = validateQueryParameters(resourceSchema, queryStrings);
if (bodyValidation.length > 0) {
const modelState = Object.assign({}, ...bodyValidation.map((x) => ({ [x]: 'Invalid property' })));
Expand Down
Loading

0 comments on commit b942c70

Please sign in to comment.