chore: fix uploads int suite
This commit is contained in:
5
.gitignore
vendored
5
.gitignore
vendored
@@ -8,12 +8,15 @@ test-results
|
|||||||
.devcontainer
|
.devcontainer
|
||||||
.localstack
|
.localstack
|
||||||
/migrations
|
/migrations
|
||||||
/media
|
|
||||||
.localstack
|
.localstack
|
||||||
.turbo
|
.turbo
|
||||||
|
|
||||||
.turbo
|
.turbo
|
||||||
|
|
||||||
|
# Ignore test directory media folder/files
|
||||||
|
/media
|
||||||
|
/versions
|
||||||
|
|
||||||
# Created by https://www.toptal.com/developers/gitignore/api/node,macos,windows,webstorm,sublimetext,visualstudiocode
|
# Created by https://www.toptal.com/developers/gitignore/api/node,macos,windows,webstorm,sublimetext,visualstudiocode
|
||||||
# Edit at https://www.toptal.com/developers/gitignore?templates=node,macos,windows,webstorm,sublimetext,visualstudiocode
|
# Edit at https://www.toptal.com/developers/gitignore?templates=node,macos,windows,webstorm,sublimetext,visualstudiocode
|
||||||
|
|
||||||
|
|||||||
@@ -54,7 +54,6 @@ export default buildConfigWithDefaults({
|
|||||||
slug: 'gif-resize',
|
slug: 'gif-resize',
|
||||||
fields: [],
|
fields: [],
|
||||||
upload: {
|
upload: {
|
||||||
staticURL: '/media-gif',
|
|
||||||
staticDir: path.resolve(process.cwd(), 'test/uploads/media-gif'),
|
staticDir: path.resolve(process.cwd(), 'test/uploads/media-gif'),
|
||||||
mimeTypes: ['image/gif'],
|
mimeTypes: ['image/gif'],
|
||||||
resizeOptions: {
|
resizeOptions: {
|
||||||
@@ -85,7 +84,6 @@ export default buildConfigWithDefaults({
|
|||||||
slug: 'no-image-sizes',
|
slug: 'no-image-sizes',
|
||||||
fields: [],
|
fields: [],
|
||||||
upload: {
|
upload: {
|
||||||
staticURL: '/no-image-sizes',
|
|
||||||
staticDir: path.resolve(process.cwd(), 'test/uploads/no-image-sizes'),
|
staticDir: path.resolve(process.cwd(), 'test/uploads/no-image-sizes'),
|
||||||
mimeTypes: ['image/png', 'image/jpg', 'image/jpeg'],
|
mimeTypes: ['image/png', 'image/jpg', 'image/jpeg'],
|
||||||
resizeOptions: {
|
resizeOptions: {
|
||||||
@@ -99,7 +97,6 @@ export default buildConfigWithDefaults({
|
|||||||
slug: 'object-fit',
|
slug: 'object-fit',
|
||||||
fields: [],
|
fields: [],
|
||||||
upload: {
|
upload: {
|
||||||
staticURL: '/object-fit',
|
|
||||||
staticDir: path.resolve(process.cwd(), 'test/uploads/object-fit'),
|
staticDir: path.resolve(process.cwd(), 'test/uploads/object-fit'),
|
||||||
mimeTypes: ['image/png', 'image/jpg', 'image/jpeg'],
|
mimeTypes: ['image/png', 'image/jpg', 'image/jpeg'],
|
||||||
imageSizes: [
|
imageSizes: [
|
||||||
@@ -135,7 +132,6 @@ export default buildConfigWithDefaults({
|
|||||||
fields: [],
|
fields: [],
|
||||||
upload: {
|
upload: {
|
||||||
focalPoint: false,
|
focalPoint: false,
|
||||||
staticURL: '/crop-only',
|
|
||||||
staticDir: path.resolve(process.cwd(), 'test/uploads/crop-only'),
|
staticDir: path.resolve(process.cwd(), 'test/uploads/crop-only'),
|
||||||
mimeTypes: ['image/png', 'image/jpg', 'image/jpeg'],
|
mimeTypes: ['image/png', 'image/jpg', 'image/jpeg'],
|
||||||
imageSizes: [
|
imageSizes: [
|
||||||
@@ -162,7 +158,6 @@ export default buildConfigWithDefaults({
|
|||||||
fields: [],
|
fields: [],
|
||||||
upload: {
|
upload: {
|
||||||
crop: false,
|
crop: false,
|
||||||
staticURL: '/focal-only',
|
|
||||||
staticDir: path.resolve(process.cwd(), 'test/uploads/focal-only'),
|
staticDir: path.resolve(process.cwd(), 'test/uploads/focal-only'),
|
||||||
mimeTypes: ['image/png', 'image/jpg', 'image/jpeg'],
|
mimeTypes: ['image/png', 'image/jpg', 'image/jpeg'],
|
||||||
imageSizes: [
|
imageSizes: [
|
||||||
@@ -189,7 +184,6 @@ export default buildConfigWithDefaults({
|
|||||||
fields: [],
|
fields: [],
|
||||||
upload: {
|
upload: {
|
||||||
staticDir: path.resolve(process.cwd(), 'test/uploads/media'),
|
staticDir: path.resolve(process.cwd(), 'test/uploads/media'),
|
||||||
staticURL: '/test/uploads/media',
|
|
||||||
// crop: false,
|
// crop: false,
|
||||||
// focalPoint: false,
|
// focalPoint: false,
|
||||||
formatOptions: {
|
formatOptions: {
|
||||||
@@ -286,7 +280,6 @@ export default buildConfigWithDefaults({
|
|||||||
slug: enlargeSlug,
|
slug: enlargeSlug,
|
||||||
fields: [],
|
fields: [],
|
||||||
upload: {
|
upload: {
|
||||||
staticURL: '/enlarge',
|
|
||||||
staticDir: path.resolve(process.cwd(), 'test/uploads/media/enlarge'),
|
staticDir: path.resolve(process.cwd(), 'test/uploads/media/enlarge'),
|
||||||
mimeTypes: [
|
mimeTypes: [
|
||||||
'image/png',
|
'image/png',
|
||||||
@@ -334,7 +327,6 @@ export default buildConfigWithDefaults({
|
|||||||
slug: reduceSlug,
|
slug: reduceSlug,
|
||||||
fields: [],
|
fields: [],
|
||||||
upload: {
|
upload: {
|
||||||
staticURL: '/reduce',
|
|
||||||
staticDir: path.resolve(process.cwd(), 'test/uploads/media/reduce'),
|
staticDir: path.resolve(process.cwd(), 'test/uploads/media/reduce'),
|
||||||
imageSizes: [
|
imageSizes: [
|
||||||
{
|
{
|
||||||
@@ -376,27 +368,20 @@ export default buildConfigWithDefaults({
|
|||||||
slug: 'media-trim',
|
slug: 'media-trim',
|
||||||
fields: [],
|
fields: [],
|
||||||
upload: {
|
upload: {
|
||||||
staticURL: '/media-trim',
|
|
||||||
staticDir: path.resolve(process.cwd(), 'test/uploads/media-trim'),
|
staticDir: path.resolve(process.cwd(), 'test/uploads/media-trim'),
|
||||||
mimeTypes: ['image/png', 'image/jpg', 'image/jpeg'],
|
mimeTypes: ['image/png', 'image/jpg', 'image/jpeg'],
|
||||||
trimOptions: {
|
trimOptions: 0,
|
||||||
threshold: 0,
|
|
||||||
},
|
|
||||||
imageSizes: [
|
imageSizes: [
|
||||||
{
|
{
|
||||||
name: 'trimNumber',
|
name: 'trimNumber',
|
||||||
height: undefined,
|
height: undefined,
|
||||||
trimOptions: {
|
trimOptions: 0,
|
||||||
threshold: 0,
|
|
||||||
},
|
|
||||||
width: 1024,
|
width: 1024,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'trimString',
|
name: 'trimString',
|
||||||
height: undefined,
|
height: undefined,
|
||||||
trimOptions: {
|
trimOptions: 0,
|
||||||
threshold: 0,
|
|
||||||
},
|
|
||||||
width: 1024,
|
width: 1024,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -416,7 +401,6 @@ export default buildConfigWithDefaults({
|
|||||||
fields: [],
|
fields: [],
|
||||||
upload: {
|
upload: {
|
||||||
disableLocalStorage: true,
|
disableLocalStorage: true,
|
||||||
staticURL: '/media',
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -424,7 +408,6 @@ export default buildConfigWithDefaults({
|
|||||||
fields: [],
|
fields: [],
|
||||||
upload: {
|
upload: {
|
||||||
// Either use another web server like `npx serve -l 4000` (http://localhost:4000) or use the static server from the previous collection to serve the media folder (http://localhost:3000/media)
|
// Either use another web server like `npx serve -l 4000` (http://localhost:4000) or use the static server from the previous collection to serve the media folder (http://localhost:3000/media)
|
||||||
staticURL: 'http://localhost:3000/media',
|
|
||||||
staticDir: path.resolve(process.cwd(), 'test/uploads/media'),
|
staticDir: path.resolve(process.cwd(), 'test/uploads/media'),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -437,14 +420,12 @@ export default buildConfigWithDefaults({
|
|||||||
upload: {
|
upload: {
|
||||||
filesRequiredOnCreate: false,
|
filesRequiredOnCreate: false,
|
||||||
staticDir: path.resolve(process.cwd(), 'test/uploads/optional'),
|
staticDir: path.resolve(process.cwd(), 'test/uploads/optional'),
|
||||||
staticURL: '/optional',
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
slug: 'required-file',
|
slug: 'required-file',
|
||||||
fields: [],
|
fields: [],
|
||||||
upload: {
|
upload: {
|
||||||
staticURL: '/required',
|
|
||||||
staticDir: path.resolve(process.cwd(), 'test/uploads/required'),
|
staticDir: path.resolve(process.cwd(), 'test/uploads/required'),
|
||||||
filesRequiredOnCreate: true,
|
filesRequiredOnCreate: true,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ describe('Collections - Uploads', () => {
|
|||||||
|
|
||||||
// Check api response
|
// Check api response
|
||||||
expect(doc.mimeType).toEqual('image/png')
|
expect(doc.mimeType).toEqual('image/png')
|
||||||
expect(sizes.maintainedAspectRatio.url).toContain('/media/image')
|
expect(sizes.maintainedAspectRatio.url).toContain('/api/media/file/image')
|
||||||
expect(sizes.maintainedAspectRatio.url).toContain('.png')
|
expect(sizes.maintainedAspectRatio.url).toContain('.png')
|
||||||
expect(sizes.maintainedAspectRatio.width).toEqual(1024)
|
expect(sizes.maintainedAspectRatio.width).toEqual(1024)
|
||||||
expect(sizes.maintainedAspectRatio.height).toEqual(1024)
|
expect(sizes.maintainedAspectRatio.height).toEqual(1024)
|
||||||
|
|||||||
Reference in New Issue
Block a user