@unchainedshop/file-upload 2.0.0-beta8 → 2.0.0-beta9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/jest.config.js CHANGED
@@ -2,4 +2,13 @@
2
2
  export default {
3
3
  preset: 'ts-jest',
4
4
  testEnvironment: 'node',
5
+ extensionsToTreatAsEsm: ['.ts'],
6
+ transform: {
7
+ '^.+\\.tsx?$': [
8
+ 'ts-jest',
9
+ {
10
+ useESM: true,
11
+ },
12
+ ],
13
+ },
5
14
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unchainedshop/file-upload",
3
- "version": "2.0.0-beta8",
3
+ "version": "2.0.0-beta9",
4
4
  "main": "lib/file-upload-index.js",
5
5
  "exports": {
6
6
  ".": "./lib/file-upload-index.js",
@@ -12,7 +12,8 @@
12
12
  "clean": "rm -rf lib",
13
13
  "build": "npm run clean && tsc",
14
14
  "watch": "tsc -w",
15
- "test": "jest --watch"
15
+ "test": "NODE_OPTIONS=--experimental-vm-modules jest --detectOpenHandles --forceExit",
16
+ "test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch --detectOpenHandles --forceExit"
16
17
  },
17
18
  "repository": {
18
19
  "type": "git",
@@ -30,18 +31,18 @@
30
31
  },
31
32
  "homepage": "https://github.com/unchainedshop/unchained#readme",
32
33
  "dependencies": {
33
- "@unchainedshop/logger": "^2.0.0-beta8",
34
- "@unchainedshop/utils": "^2.0.0-beta8",
34
+ "@unchainedshop/logger": "^2.0.0-beta9",
35
+ "@unchainedshop/utils": "^2.0.0-beta9",
35
36
  "base-x": "4.0.0",
36
37
  "mime-types": "^2.1.35",
37
38
  "minio": "^7.0.32"
38
39
  },
39
40
  "devDependencies": {
40
41
  "@types/minio": "^7.0.15",
41
- "@types/node": "^18.11.9",
42
- "@unchainedshop/types": "^2.0.0-beta8",
42
+ "@types/node": "^18.11.12",
43
+ "@unchainedshop/types": "^2.0.0-beta9",
43
44
  "jest": "^29.3.1",
44
45
  "ts-jest": "^29.0.3",
45
- "typescript": "^4.9.3"
46
+ "typescript": "^4.9.4"
46
47
  }
47
48
  }
@@ -1,16 +1,8 @@
1
- import { assert } from 'chai';
2
- import { FileDirector, FileAdapter } from '@unchainedshop/file-upload';
1
+ import buildHashedFilename from "../lib/buildHashedFilename";
3
2
 
4
- describe('Test exports', () => {
5
- it('Check expors', () => {
6
- assert.ok(FileDirector);
7
- assert.isFunction(FileDirector.registerAdapter);
8
- assert.isFunction(FileDirector.registerFileUploadCallback);
9
3
 
10
- assert.ok(FileAdapter);
11
- assert.isFunction(FileAdapter.createSignedURL);
12
- assert.isFunction(FileAdapter.removeFiles);
13
- assert.isFunction(FileAdapter.uploadFileFromStream);
14
- assert.isFunction(FileAdapter.uploadFileFromURL);
4
+ describe('File Uploader', () => {
5
+ it('Generate unique file name', async () => {
6
+ expect(buildHashedFilename('root', 'file1.jpg', new Date(new Date("2022-12-04T17:13:09.285Z")))).toEqual("4hI2YuPDacR8ERoR7iM6cQ-file1.jpg")
15
7
  });
16
8
  });