Skip to content
This repository has been archived by the owner on Oct 30, 2022. It is now read-only.

Commit

Permalink
Merge pull request #373 from unmock/release/v0.3.12
Browse files Browse the repository at this point in the history
Release v0.3.12.
  • Loading branch information
Kimmo Sääskilahti committed Jan 10, 2020
2 parents 86a02a2 + d7e3a04 commit 5e21b98
Show file tree
Hide file tree
Showing 20 changed files with 2,884 additions and 1,064 deletions.
10 changes: 10 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# CHANGELOG.md

## 0.3.12 (2020-01-09)

Fixes:

- Fixed bug in `unmock-server` CLI by including `oclif.manifest.json` in the package.

Features:

- Updated packages to fix security vulnerabilities

## 0.3.11 (2019-12-19)

Features:
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"packages": [
"packages/**"
],
"version": "0.3.11"
"version": "0.3.12"
}
3,730 changes: 2,748 additions & 982 deletions package-lock.json

Large diffs are not rendered by default.

33 changes: 17 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,28 +37,29 @@
]
},
"devDependencies": {
"@babel/preset-env": "^7.6.0",
"@babel/preset-react": "^7.0.0",
"@testing-library/jest-dom": "^4.1.0",
"@babel/preset-env": "^7.7.7",
"@babel/preset-react": "^7.7.4",
"@oclif/dev-cli": "^1.22.2",
"@testing-library/jest-dom": "^4.2.4",
"@types/app-root-path": "^1.2.4",
"@types/content-type": "^1.1.3",
"@types/debug": "^4.1.4",
"@types/glob": "^7.1.1",
"@types/ini": "^1.3.30",
"@types/jest": "^24.0.11",
"@types/jest": "^24.0.25",
"@types/js-yaml": "^3.12.1",
"@types/jsdom": "^12.2.4",
"@types/json-pointer": "^1.0.30",
"@types/lodash": "^4.14.136",
"@types/lodash": "^4.14.149",
"@types/mitm": "^1.3.2",
"@types/mkdirp": "^0.5.2",
"@types/node": "^8.10.51",
"@types/react": "^16.9.2",
"@types/react-dom": "^16.9.0",
"@types/node": "^8.10.59",
"@types/react": "^16.9.17",
"@types/react-dom": "^16.9.4",
"@types/seedrandom": "^2.4.28",
"@types/shimmer": "^1.0.1",
"@types/supertest": "^2.0.8",
"@types/uuid": "^3.4.5",
"@types/uuid": "^3.4.6",
"axios": "^0.19.0",
"babel-jest": "^24.9.0",
"codecov": "^3.3.0",
Expand All @@ -67,18 +68,18 @@
"express": "^4.16.4",
"jest": "^24.7.1",
"jest-junit": "^6.4.0",
"jsdom": "^15.1.1",
"lerna": "^3.13.4",
"jsdom": "^15.2.1",
"lerna": "^3.20.2",
"lodash.template": "^4.5.0",
"markdown-toc": "^1.2.0",
"prettier": "^1.18.2",
"prettier": "^1.19.1",
"prettier-check": "^2.0.0",
"supertest": "^4.0.2",
"ts-jest": "^24.0.2",
"ts-node": "^8.3.0",
"tslint": "^5.16.0",
"ts-jest": "^24.3.0",
"ts-node": "^8.5.4",
"tslint": "^5.20.1",
"tslint-config-prettier": "^1.18.0",
"typescript": "^3.6.3"
"typescript": "^3.7.4"
},
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion packages/openapi-refinements/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "0.3.11",
"version": "0.3.12",
"name": "openapi-refinements",
"displayName": "openapi-refinements",
"main": "dist/index.js",
Expand Down
5 changes: 4 additions & 1 deletion packages/openapi-refinements/src/__tests__/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,10 @@ test("changeToConst accepts const with full array", () => {
const refined = changeToConst([
{ id: 0, name: "Fluffy" },
{ id: 1, name: "Trix", tags: ["cute", "sad"] },
])(responseBody("/pets", true, ["200"]), [])(petstore);
])(
responseBody("/pets", true, ["200"]),
[],
)(petstore);
expect(
(<any>refined).paths["/pets"].get.responses["200"].content[
"application/json"
Expand Down
15 changes: 12 additions & 3 deletions packages/openapi-refinements/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ export const objectToArray = <T>() =>
);

export const valueLens = <A, T>() =>
new Lens<[A, T], T>(s => s[1], a => s => [s[0], a]);
new Lens<[A, T], T>(
s => s[1],
a => s => [s[0], a],
);

export type MethodNames =
| "get"
Expand Down Expand Up @@ -278,7 +281,10 @@ const lensToOperations = (
)
.composeLens(valueLens())
.composePrism(
new Prism<any, Operation>(s => (isOperation(s) ? some(s) : none), a => a),
new Prism<any, Operation>(
s => (isOperation(s) ? some(s) : none),
a => a,
),
);
const lensToResponses = (
path: RegExp | boolean,
Expand Down Expand Up @@ -479,7 +485,10 @@ const drillDownSchemaItems = (o: OpenAPIObject, i: number) =>
new Prism<
Schema | Reference | Array<Schema | Reference>,
Array<Schema | Reference>
>(a => (a instanceof Array ? some(a) : none), a => a),
>(
a => (a instanceof Array ? some(a) : none),
a => a,
),
)
.composeOptional(
new Optional<Array<Schema | Reference>, Schema | Reference>(
Expand Down
2 changes: 1 addition & 1 deletion packages/unmock-browser/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "unmock-browser",
"version": "0.3.11",
"version": "0.3.12",
"description": "Unmock for browser and React Native",
"keywords": [
"unmock",
Expand Down
2 changes: 1 addition & 1 deletion packages/unmock-cli/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "0.3.11",
"version": "0.3.12",
"name": "unmock-cli",
"displayName": "unmock-cli",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/unmock-core/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "0.3.11",
"version": "0.3.12",
"name": "unmock-core",
"displayName": "unmock-core",
"main": "dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/unmock-core/src/generator-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import {
} from "./service/interfaces";

const codeConvert = (c: CodeAsInt | keyof Responses): keyof Responses =>
`${c}` as (keyof Responses);
`${c}` as keyof Responses;

const withOrWithoutCodes = (withOrWithout: boolean) => (
codes: keyof Responses | CodeAsInt | Array<keyof Responses | CodeAsInt>,
Expand Down
20 changes: 16 additions & 4 deletions packages/unmock-core/src/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,10 @@ const keepMethodIfRequiredRequestBodyIsPresent = (
).length === 0
? some(p)
: none,
fold(() => omit(p, req.method), a => a),
fold(
() => omit(p, req.method),
a => a,
),
);

const keepMethodIfRequiredHeaderParametersArePresent = (
Expand Down Expand Up @@ -272,7 +275,10 @@ const keepMethodIfRequiredQueryOrHeaderParametersArePresent = (
}).valid
? some(p)
: none,
fold(() => omit(p, req.method), a => a),
fold(
() => omit(p, req.method),
a => a,
),
);

const maybeAddStringSchema = (
Expand Down Expand Up @@ -457,7 +463,10 @@ export const firstElementOptional = <T>() =>
* A lens that zooms into the `key` of a `[key, value]` pair.
*/
export const keyLens = <A, T>() =>
new Lens<[A, T], A>(a => a[0], a => s => [a, s[1]]);
new Lens<[A, T], A>(
a => a[0],
a => s => [a, s[1]],
);

const getFirstMethodInternal2 = (
p: PathItem,
Expand All @@ -484,7 +493,10 @@ export const getFirstMethod = (p: PathItem): Option<[MethodNames, Operation]> =>
export const operationOptional = new Optional<
PathItem,
[MethodNames, Operation]
>(a => getFirstMethod(a), a => s => ({ ...s, [a[0]]: a[1] }));
>(
a => getFirstMethod(a),
a => s => ({ ...s, [a[0]]: a[1] }),
);

/**
* Gets `some` header from a reference
Expand Down
85 changes: 45 additions & 40 deletions packages/unmock-core/src/nock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,10 @@ const keepOptionals = (i: IExtendedObjectType): ITameExtendedObjectType =>
new Prism<
[string, ExtendedValueType | IMaybeJSONValue],
[string, ExtendedValueType]
>(a => (MaybeJSONValue.is(a[1]) ? some([a[0], a[1].val]) : none), a => a),
>(
a => (MaybeJSONValue.is(a[1]) ? some([a[0], a[1].val]) : none),
a => a,
),
)
.composeGetter(identityGetter())
.getAll(i)
Expand Down Expand Up @@ -657,52 +660,54 @@ const buildFluentNock = (
((fds as any)[method](p) as IDynamicServiceSpec).reply(code),
),
),
}))(Object.entries(HTTPMethodsWithCommonStatusResponses).reduce(
(o, [method, code]) => ({
...o,
[method]:
method === "post" || method === "patch" || method === "put"
? (endpoint: ValidEndpointType, requestBody?: ExtendedJSONSchema) =>
new DynamicServiceSpec(
updateStore(
}))(
Object.entries(HTTPMethodsWithCommonStatusResponses).reduce(
(o, [method, code]) => ({
...o,
[method]:
method === "post" || method === "patch" || method === "put"
? (endpoint: ValidEndpointType, requestBody?: ExtendedJSONSchema) =>
new DynamicServiceSpec(
updateStore(
baseUrl,
method as HTTPMethod,
naked(endpoint),
endpointToQs(endpoint) || {},
requestHeaders as Record<string, Schema>,
requestBody !== undefined
? (vanillaJSONSchemify(requestBody) as Schema)
: undefined,
name,
),
code as CodeAsInt,
baseUrl,
method as HTTPMethod,
naked(endpoint),
endpointToQs(endpoint) || {},
requestHeaders as Record<string, Schema>,
requestBody !== undefined
? (vanillaJSONSchemify(requestBody) as Schema)
: undefined,
requestHeaders,
store,
name,
),
code as CodeAsInt,
baseUrl,
endpointToQs(endpoint) || {},
requestHeaders,
store,
name,
)
: (endpoint: ValidEndpointType) =>
new DynamicServiceSpec(
updateStore(
)
: (endpoint: ValidEndpointType) =>
new DynamicServiceSpec(
updateStore(
baseUrl,
method as HTTPMethod,
naked(endpoint),
endpointToQs(endpoint) || {},
requestHeaders as Record<string, Schema>,
undefined,
name,
),
code as CodeAsInt,
baseUrl,
method as HTTPMethod,
naked(endpoint),
endpointToQs(endpoint) || {},
requestHeaders as Record<string, Schema>,
undefined,
requestHeaders,
store,
name,
),
code as CodeAsInt,
baseUrl,
endpointToQs(endpoint) || {},
requestHeaders,
store,
name,
),
}),
{},
) as IFluentDynamicService);
}),
{},
) as IFluentDynamicService,
);

export const nockify = ({
serviceStore,
Expand Down
2 changes: 1 addition & 1 deletion packages/unmock-fetch/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "0.3.11",
"version": "0.3.12",
"name": "unmock-fetch",
"displayName": "unmock-fetch",
"main": "dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/unmock-jest/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "0.3.11",
"version": "0.3.12",
"name": "unmock-jest",
"displayName": "unmock-jest",
"main": "dist/index.js",
Expand Down
15 changes: 12 additions & 3 deletions packages/unmock-jest/src/__tests__/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ describe("Reporter utils", () => {
expect(result).toEqual(["dir", "stuff"]);
});
it("should return the whole array when all items match", () => {
const result = largestCommonArray([["dir", "stuff"], ["dir", "stuff"]]);
const result = largestCommonArray([
["dir", "stuff"],
["dir", "stuff"],
]);
expect(result).toEqual(["dir", "stuff"]);
});
it("should return empty array when one of the arrays is empty", () => {
Expand All @@ -73,11 +76,17 @@ describe("Reporter utils", () => {
expect(result).toEqual(["dir", "stuff"]);
});
it("should only return the first when the first matches", () => {
const result = largestCommonArray([["dir", "stuff"], ["dir", "baz"]]);
const result = largestCommonArray([
["dir", "stuff"],
["dir", "baz"],
]);
expect(result).toEqual(["dir"]);
});
it("should return an empty array when first item is different", () => {
const result = largestCommonArray([["dir", "stuff"], ["dir2", "stuff"]]);
const result = largestCommonArray([
["dir", "stuff"],
["dir2", "stuff"],
]);
expect(result).toEqual([]);
});
});
Expand Down
2 changes: 1 addition & 1 deletion packages/unmock-node/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "0.3.11",
"version": "0.3.12",
"name": "unmock-node",
"displayName": "unmock-node",
"main": "dist/index.js",
Expand Down
Loading

0 comments on commit 5e21b98

Please sign in to comment.