Skip to content

Commit

Permalink
fix(deps): update external fixes (#172)
Browse files Browse the repository at this point in the history
* fix(deps): update external fixes

* chore: fix tests

Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Tobias Bocanegra <tripod@adobe.com>
  • Loading branch information
3 people authored Aug 23, 2021
1 parent 6bb9b95 commit a3d8247
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions test/mediahandler.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,17 @@ Scope.prototype.s3Multipart = function s3Multipart(expectedMeta, sha = '18bb2f0e
</CompleteMultipartUploadResult>`);
};

/**
* Add custom scope interceptor chain for multipart uploads
*/
Scope.prototype.putObject = function putObject(expectedMeta, sha = '18bb2f0e55ff47be3fc32a575590b53e060b911f4') {
return this.put(`/foo-id/${sha}?x-id=PutObject`)
.reply(function reply() {
assert.deepStrictEqual(extractMeta(this.req.headers), expectedMeta);
return [201];
});
};

describe('MediaHandler', () => {
['owner', 'repo', 'ref', 'contentBusId'].forEach((prop) => {
it(`fails if no ${prop}`, async () => {
Expand Down Expand Up @@ -98,7 +109,7 @@ describe('MediaHandler', () => {
const scope2 = nock('https://helix-media-bus.s3.us-east-1.amazonaws.com')
.head('/foo-id/18bb2f0e55ff47be3fc32a575590b53e060b911f4')
.reply(404)
.s3Multipart({
.putObject({
agent: `blobhandler-${version}`,
alg: '8k',
width: '477',
Expand Down Expand Up @@ -157,7 +168,7 @@ describe('MediaHandler', () => {
const scope2 = nock('https://helix-media-bus.s3.us-east-1.amazonaws.com')
.head('/foo-id/18bb2f0e55ff47be3fc32a575590b53e060b911f4')
.reply(404)
.s3Multipart({
.putObject({
agent: `blobhandler-${version}`,
alg: '8k',
'source-last-modified': '01-01-2021',
Expand Down Expand Up @@ -430,7 +441,7 @@ describe('MediaHandler', () => {
const blob = handler.createMediaResource(testImage, 0, 'image/png');

const scope = nock('https://helix-media-bus.s3.us-east-1.amazonaws.com')
.s3Multipart({
.putObject({
alg: '8k',
agent: 'blob-test',
src: '',
Expand All @@ -454,7 +465,7 @@ describe('MediaHandler', () => {
delete blob.meta.height;

const scope = nock('https://helix-media-bus.s3.us-east-1.amazonaws.com')
.s3Multipart({
.putObject({
alg: '8k',
agent: 'blob-test',
src: 'https://www.foo.com',
Expand Down Expand Up @@ -486,7 +497,7 @@ describe('MediaHandler', () => {
const blob = await handler.createMediaResourceFromStream(testStream, 613, 'image/png');

const scope = nock('https://helix-media-bus.s3.us-east-1.amazonaws.com')
.s3Multipart({
.putObject({
alg: '8k',
agent: 'blob-test',
src: '',
Expand Down Expand Up @@ -539,7 +550,7 @@ describe('MediaHandler', () => {
const scope2 = nock('https://helix-media-bus.s3.us-east-1.amazonaws.com')
.head('/foo-id/anotherittest_18bb2f0e55ff47be3fc32a575590b53e060b911f4')
.reply(404)
.s3Multipart({
.putObject({
agent: 'blob-test',
alg: '8k',
height: '268',
Expand Down Expand Up @@ -601,7 +612,7 @@ describe('MediaHandler', () => {
const scope2 = nock('https://helix-media-bus.s3.us-east-1.amazonaws.com')
.head('/foo-id/18bb2f0e55ff47be3fc32a575590b53e060b911f4')
.reply(404)
.s3Multipart({
.putObject({
agent: `blobhandler-${version}`,
alg: '8k',
height: '268',
Expand Down Expand Up @@ -649,7 +660,7 @@ describe('MediaHandler', () => {
blob.meta.src = '/some-source';

const scope = nock('https://helix-media-bus.s3.us-east-1.amazonaws.com')
.s3Multipart({
.putObject({
alg: '8k',
agent: 'blob-test',
src: '/some-source',
Expand Down

0 comments on commit a3d8247

Please sign in to comment.