From fbfeb37e68ea6458de6995dd01b41102c0f5de56 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Tue, 6 Apr 2021 02:52:21 +0000 Subject: [PATCH 1/3] template: runtypes ^6.0.0 --- template/koa-rest-api/package.json | 2 +- template/lambda-sqs-worker/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/template/koa-rest-api/package.json b/template/koa-rest-api/package.json index b60464af3..fdeceac03 100644 --- a/template/koa-rest-api/package.json +++ b/template/koa-rest-api/package.json @@ -7,7 +7,7 @@ "koa": "^2.13.0", "koa-bodyparser": "^4.3.0", "koa-compose": "^4.2.0", - "runtypes": "^5.0.1", + "runtypes": "^6.0.0", "runtypes-filter": "^0.5.0", "seek-datadog-custom-metrics": "^4.0.0", "seek-koala": "^5.1.0", diff --git a/template/lambda-sqs-worker/package.json b/template/lambda-sqs-worker/package.json index a0253710a..64e9372e5 100644 --- a/template/lambda-sqs-worker/package.json +++ b/template/lambda-sqs-worker/package.json @@ -4,7 +4,7 @@ "aws-sdk": "^2.831.0", "seek-datadog-custom-metrics": "^4.0.0", "skuba-dive": "^1.1.2", - "runtypes": "^5.0.1", + "runtypes": "^6.0.0", "runtypes-filter": "^0.5.0" }, "devDependencies": { From 0060c763de03e5c7368431674c9b1979b5e1ebb9 Mon Sep 17 00:00:00 2001 From: Ryan Ling Date: Wed, 7 Apr 2021 01:08:19 +1000 Subject: [PATCH 2/3] Update validation snapshots --- .../koa-rest-api/src/api/jobs/postJob.test.ts | 8 +++++--- .../koa-rest-api/src/framework/validation.test.ts | 15 +++++++++++---- .../src/framework/validation.test.ts | 4 ++-- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/template/koa-rest-api/src/api/jobs/postJob.test.ts b/template/koa-rest-api/src/api/jobs/postJob.test.ts index d38b6b857..f78bb45a6 100644 --- a/template/koa-rest-api/src/api/jobs/postJob.test.ts +++ b/template/koa-rest-api/src/api/jobs/postJob.test.ts @@ -24,9 +24,11 @@ describe('postJobHandler', () => { return agent .post('/') .send(jobInput) - .expect( - 422, - 'Expected "hirer" property to be present, but was missing in hirer', + .expect(422) + .expect(({ text }) => + expect(text).toMatchInlineSnapshot( + `"Expected { hirer: { id: string; }; }, but was incompatible"`, + ), ); }); }); diff --git a/template/koa-rest-api/src/framework/validation.test.ts b/template/koa-rest-api/src/framework/validation.test.ts index a27eb554e..8a8726fb3 100644 --- a/template/koa-rest-api/src/framework/validation.test.ts +++ b/template/koa-rest-api/src/framework/validation.test.ts @@ -40,15 +40,22 @@ describe('validate', () => { return agent .post('/') .send({ ...idDescription, id: null }) - .expect(422, 'Expected string, but was null in id'); + .expect(422) + .expect(({ text }) => + expect(text).toMatchInlineSnapshot( + `"Expected { id: string; description: string; }, but was incompatible"`, + ), + ); }); it('blocks missing props', () => agent .post('/') .send({}) - .expect( - 422, - 'Expected "id" property to be present, but was missing in id', + .expect(422) + .expect(({ text }) => + expect(text).toMatchInlineSnapshot( + `"Expected { id: string; description: string; }, but was incompatible"`, + ), )); }); diff --git a/template/lambda-sqs-worker/src/framework/validation.test.ts b/template/lambda-sqs-worker/src/framework/validation.test.ts index db2dfd63b..020ef74c5 100644 --- a/template/lambda-sqs-worker/src/framework/validation.test.ts +++ b/template/lambda-sqs-worker/src/framework/validation.test.ts @@ -31,7 +31,7 @@ describe('validateJson', () => { expect(() => validateJson(input, filterIdDescription), ).toThrowErrorMatchingInlineSnapshot( - `"Expected string, but was null in id"`, + `"Expected { id: string; description: string; }, but was incompatible"`, ); }); @@ -41,7 +41,7 @@ describe('validateJson', () => { expect(() => validateJson(input, filterIdDescription), ).toThrowErrorMatchingInlineSnapshot( - `"Expected \\"id\\" property to be present, but was missing in id"`, + `"Expected { id: string; description: string; }, but was incompatible"`, ); }); From 1fad00d8d48b6a74950b97fc647063e1f4cda9fb Mon Sep 17 00:00:00 2001 From: Ryan Ling Date: Wed, 7 Apr 2021 01:08:44 +1000 Subject: [PATCH 3/3] Add changeset --- .changeset/khaki-glasses-vanish.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/khaki-glasses-vanish.md diff --git a/.changeset/khaki-glasses-vanish.md b/.changeset/khaki-glasses-vanish.md new file mode 100644 index 000000000..25f58fa0e --- /dev/null +++ b/.changeset/khaki-glasses-vanish.md @@ -0,0 +1,5 @@ +--- +'skuba': patch +--- + +**template:** runtypes ^6.0.0