@beyonk/content-delivery
Advanced tools
Comparing version 1.0.7 to 1.1.0
import { extension } from './mime-type' | ||
function getCdnUrl (metadata, width = 'large') { | ||
const base = [`https://adaptive.delivery/api/v1`] | ||
const base = [ process.env.cdnBaseUrl ] | ||
@@ -6,0 +6,0 @@ base.push('beyonk') |
@@ -6,8 +6,16 @@ 'use strict' | ||
describe('cdn-url', () => { | ||
before(() => { | ||
process.env.cdnBaseUrl = 'https://test.adaptive.delivery/api/v1' | ||
}) | ||
after(() => { | ||
delete process.env.cdnBaseUrl | ||
}) | ||
describe('#getCdnUrl()', () => { | ||
context('with image descriptor', () => { | ||
const scenarios = [ | ||
{ size: 'small', expected: 'https://adaptive.delivery/api/v1/beyonk/q/small/something%2Fabc123.webp' }, | ||
{ size: 'tiny', expected: 'https://adaptive.delivery/api/v1/beyonk/q/tiny/something%2Fabc123.webp' }, | ||
{ size: undefined, expected: 'https://adaptive.delivery/api/v1/beyonk/q/large/something%2Fabc123.webp' } | ||
{ size: 'small', expected: 'https://test.adaptive.delivery/api/v1/beyonk/q/small/something%2Fabc123.webp' }, | ||
{ size: 'tiny', expected: 'https://test.adaptive.delivery/api/v1/beyonk/q/tiny/something%2Fabc123.webp' }, | ||
{ size: undefined, expected: 'https://test.adaptive.delivery/api/v1/beyonk/q/large/something%2Fabc123.webp' } | ||
] | ||
@@ -45,3 +53,3 @@ | ||
getCdnUrl(descriptor) | ||
).to.equal('https://adaptive.delivery/api/v1/beyonk/q/large/missing.jpeg') | ||
).to.equal('https://test.adaptive.delivery/api/v1/beyonk/q/large/missing.jpeg') | ||
}) | ||
@@ -48,0 +56,0 @@ }) |
{ | ||
"name": "@beyonk/content-delivery", | ||
"version": "1.0.7", | ||
"version": "1.1.0", | ||
"description": "Beyonk Content Delivery Utils", | ||
@@ -29,3 +29,3 @@ "author": "Antony Jones <aj@desirableobjects.co.uk>", | ||
}, | ||
"gitHead": "96cf1ae518bedbe531fcb37788a0b907d3007a3a" | ||
"gitHead": "785fc457bb53ca2528509f411a4a2cbc7f9dfee7" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5487
144
5