MCPcopy
hub / github.com/loopbackio/loopback-next / test

Function test

packages/rest/src/__tests__/unit/coercion/utils.ts:109–128  ·  view source on GitHub ↗
(
  paramSpec: ParameterObject,
  rawValue: string | undefined | object,
  expectedResult: T,
  opts?: TestOptions,
)

Source from the content-addressed store, hash-verified

107}
108
109export function test<T>(
110 paramSpec: ParameterObject,
111 rawValue: string | undefined | object,
112 expectedResult: T,
113 opts?: TestOptions,
114) {
115 const caller: string = new Error().stack!;
116 const testName = buildTestName(rawValue, expectedResult, opts);
117
118 it(testName, async () => {
119 await testCoercion({
120 paramSpec,
121 rawValue,
122 expectedResult,
123 caller,
124 expectError: expectedResult instanceof HttpErrors.HttpError,
125 opts: opts ?? {},
126 });
127 });
128}
129
130function buildTestName<T>(
131 rawValue: string | undefined | object,

Calls 2

buildTestNameFunction · 0.85
testCoercionFunction · 0.85

Tested by

no test coverage detected