diff --git a/README.md b/README.md index 25e6506ac..06d7410f5 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,8 @@ --- -[![Build Status CI alpha](https://github.com/parse-community/Parse-SDK-JS/workflows/ci/badge.svg?branch=alpha)](https://github.com/parse-community/Parse-SDK-JS/actions?query=workflow%3Aci+branch%3Aalpha) +[![Build Status CI alpha](https://github.com/parse-community/Parse-SDK-JS/workflows/ci/badge.svg?branch=alpha&subject=alpha)](https://github.com/parse-community/Parse-SDK-JS/actions?query=workflow%3Aci+branch%3Aalpha) +[![Build Status CI beta](https://github.com/parse-community/Parse-SDK-JS/workflows/ci/badge.svg?branch=beta)](https://github.com/parse-community/Parse-SDK-JS/actions?query=workflow%3Aci+branch%3Abeta) [![Build Status CI release](https://github.com/parse-community/Parse-SDK-JS/workflows/ci/badge.svg?branch=release)](https://github.com/parse-community/Parse-SDK-JS/actions?query=workflow%3Aci+branch%3Arelease) [![Snyk Badge](https://snyk.io/test/github/parse-community/Parse-SDK-JS/badge.svg)](https://snyk.io/test/github/parse-community/Parse-SDK-JS) [![Coverage](http://codecov.io/github/parse-community/Parse-SDK-JS/coverage.svg?branch=alpha)](http://codecov.io/github/parse-community/Parse-SDK-JS?branch=alpha) diff --git a/changelogs/CHANGELOG_alpha.md b/changelogs/CHANGELOG_alpha.md index e5bd9fad3..468d962f3 100644 --- a/changelogs/CHANGELOG_alpha.md +++ b/changelogs/CHANGELOG_alpha.md @@ -1,3 +1,32 @@ +## [3.5.1-alpha.2](https://github.com/parse-community/Parse-SDK-JS/compare/3.5.1-alpha.1...3.5.1-alpha.2) (2022-11-07) + + +### Bug Fixes + +* SDK builds incorrectly since release 3.5.0 causing various bugs ([#1600](https://github.com/parse-community/Parse-SDK-JS/issues/1600)) ([f15154f](https://github.com/parse-community/Parse-SDK-JS/commit/f15154f903478f997bf127be198097a58c602594)) + +## [3.5.1-alpha.1](https://github.com/parse-community/Parse-SDK-JS/compare/3.5.0...3.5.1-alpha.1) (2022-11-03) + + +### Bug Fixes + +* File upload fails when uploading base64 data ([#1578](https://github.com/parse-community/Parse-SDK-JS/issues/1578)) ([03ee3ff](https://github.com/parse-community/Parse-SDK-JS/commit/03ee3ffd3e4798f9dd958ddc24b9f774cb875507)) +* React Native build does not maintain arrow functions and causes error with AsyncStorage ([#1587](https://github.com/parse-community/Parse-SDK-JS/issues/1587)) ([8aeaa4f](https://github.com/parse-community/Parse-SDK-JS/commit/8aeaa4f51e01f5763c497b5e86dca73835e2144b)) + +# [3.5.0-alpha.8](https://github.com/parse-community/Parse-SDK-JS/compare/3.5.0-alpha.7...3.5.0-alpha.8) (2022-11-03) + + +### Bug Fixes + +* File upload fails when uploading base64 data ([#1578](https://github.com/parse-community/Parse-SDK-JS/issues/1578)) ([03ee3ff](https://github.com/parse-community/Parse-SDK-JS/commit/03ee3ffd3e4798f9dd958ddc24b9f774cb875507)) + +# [3.5.0-alpha.7](https://github.com/parse-community/Parse-SDK-JS/compare/3.5.0-alpha.6...3.5.0-alpha.7) (2022-11-01) + + +### Bug Fixes + +* React Native build does not maintain arrow functions and causes error with AsyncStorage ([#1587](https://github.com/parse-community/Parse-SDK-JS/issues/1587)) ([8aeaa4f](https://github.com/parse-community/Parse-SDK-JS/commit/8aeaa4f51e01f5763c497b5e86dca73835e2144b)) + # [3.5.0-alpha.6](https://github.com/parse-community/Parse-SDK-JS/compare/3.5.0-alpha.5...3.5.0-alpha.6) (2022-10-13) diff --git a/changelogs/CHANGELOG_beta.md b/changelogs/CHANGELOG_beta.md index 1532570b8..ad5cb1300 100644 --- a/changelogs/CHANGELOG_beta.md +++ b/changelogs/CHANGELOG_beta.md @@ -1,3 +1,18 @@ +## [3.5.1-beta.2](https://github.com/parse-community/Parse-SDK-JS/compare/3.5.1-beta.1...3.5.1-beta.2) (2022-11-26) + + +### Bug Fixes + +* SDK builds incorrectly since release 3.5.0 causing various bugs ([#1600](https://github.com/parse-community/Parse-SDK-JS/issues/1600)) ([f15154f](https://github.com/parse-community/Parse-SDK-JS/commit/f15154f903478f997bf127be198097a58c602594)) + +## [3.5.1-beta.1](https://github.com/parse-community/Parse-SDK-JS/compare/3.5.0...3.5.1-beta.1) (2022-11-03) + + +### Bug Fixes + +* File upload fails when uploading base64 data ([#1578](https://github.com/parse-community/Parse-SDK-JS/issues/1578)) ([03ee3ff](https://github.com/parse-community/Parse-SDK-JS/commit/03ee3ffd3e4798f9dd958ddc24b9f774cb875507)) +* React Native build does not maintain arrow functions and causes error with AsyncStorage ([#1587](https://github.com/parse-community/Parse-SDK-JS/issues/1587)) ([8aeaa4f](https://github.com/parse-community/Parse-SDK-JS/commit/8aeaa4f51e01f5763c497b5e86dca73835e2144b)) + # [3.5.0-beta.1](https://github.com/parse-community/Parse-SDK-JS/compare/3.4.4...3.5.0-beta.1) (2022-10-25) diff --git a/gulpfile.js b/gulpfile.js index d461b2709..80628d202 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -12,7 +12,7 @@ const watch = require('gulp-watch'); const BUILD = process.env.PARSE_BUILD || 'browser'; const VERSION = require('./package.json').version; -const transformRuntime = ["@babel/plugin-transform-runtime", { +const transformRuntime = ["@babel/transform-runtime", { "corejs": 3, "helpers": true, "regenerator": true, @@ -22,10 +22,10 @@ const transformRuntime = ["@babel/plugin-transform-runtime", { const PRESETS = { 'browser': [["@babel/preset-env", { "targets": "> 0.25%, not dead" - }], '@babel/preset-react'], + }]], 'weapp': [["@babel/preset-env", { "targets": "> 0.25%, not dead" - }], '@babel/preset-react'], + }], '@babel/react'], 'node': [["@babel/preset-env", { "targets": { "node": "8" } }]], diff --git a/integration/test/ParseDistTest.js b/integration/test/ParseDistTest.js new file mode 100644 index 000000000..7beb32ab8 --- /dev/null +++ b/integration/test/ParseDistTest.js @@ -0,0 +1,31 @@ +const puppeteer = require('puppeteer'); +let page = null; +for (const fileName of ['parse.js', 'parse.min.js']) { + beforeAll(async () => { + const browser = await puppeteer.launch(); + page = await browser.newPage(); + await page.goto(`http://localhost:1337/${fileName}`); + }); + describe(`Parse Dist Test ${fileName}`, () => { + it('can save an object', async () => { + const response = await page.evaluate(async () => { + const object = await new Parse.Object('TestObject').save(); + return object.id; + }); + expect(response).toBeDefined(); + const obj = await new Parse.Query('TestObject').first(); + expect(obj).toBeDefined(); + expect(obj.id).toEqual(response); + }); + it('can query an object', async () => { + const obj = await new Parse.Object('TestObject').save(); + const response = await page.evaluate(async () => { + const object = await new Parse.Query('TestObject').first(); + return object.id; + }); + expect(response).toBeDefined(); + expect(obj).toBeDefined(); + expect(obj.id).toEqual(response); + }); + }); +} diff --git a/integration/test/ParseFileTest.js b/integration/test/ParseFileTest.js index c594ff3d3..d8e68c309 100644 --- a/integration/test/ParseFileTest.js +++ b/integration/test/ParseFileTest.js @@ -64,7 +64,7 @@ describe('Parse.File', () => { assert.equal(data, 'ParseA=='); }); - it('can get file data from base64', async () => { + it('can get file data from base64 (saved)', async () => { const file = new Parse.File('parse-server-logo', { base64: 'ParseA==' }); await file.save(); let data = await file.getData(); @@ -76,6 +76,12 @@ describe('Parse.File', () => { assert.equal(data, 'ParseA=='); }); + it('can get file data from base64 (unsaved)', async () => { + const file = new Parse.File('parse-server-logo', { base64: 'ParseA==' }); + const data = await file.getData(); + assert.equal(data, 'ParseA=='); + }); + it('can get file data from full base64', async () => { const file = new Parse.File('parse-server-logo', { base64: 'data:image/jpeg;base64,ParseA==', diff --git a/integration/test/helper.js b/integration/test/helper.js index 836953f3e..10ceb92ee 100644 --- a/integration/test/helper.js +++ b/integration/test/helper.js @@ -8,6 +8,8 @@ const CustomAuth = require('./CustomAuth'); const sleep = require('./sleep'); const { TestUtils } = require('parse-server'); const Parse = require('../../node'); +const fs = require('fs'); +const path = require('path'); const port = 1337; const mountPath = '/parse'; @@ -115,6 +117,27 @@ const reconfigureServer = (changedConfiguration = {}) => { }); parseServer = ParseServer.start(newConfiguration); const app = parseServer.expressApp; + for (const fileName of ['parse.js', 'parse.min.js']) { + const file = fs + .readFileSync(path.resolve(__dirname, `./../../dist/${fileName}`)) + .toString(); + app.get(`/${fileName}`, (req, res) => { + res.send(` + + + Parse Functionality Test + + + + + `); + }); + } app.get('/clear/:fast', (req, res) => { const { fast } = req.params; TestUtils.destroyAllDataPermanently(fast).then(() => { diff --git a/package-lock.json b/package-lock.json index 417dc3154..12536ad02 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "parse", - "version": "3.5.0", + "version": "3.5.1-beta.2", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -1219,9 +1219,9 @@ }, "dependencies": { "tslib": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", - "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==", + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz", + "integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==", "dev": true } } @@ -1236,9 +1236,9 @@ }, "dependencies": { "tslib": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", - "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==", + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz", + "integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==", "dev": true } } @@ -1254,9 +1254,9 @@ }, "dependencies": { "tslib": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", - "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==", + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz", + "integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==", "dev": true } } @@ -1272,9 +1272,9 @@ }, "dependencies": { "tslib": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", - "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==", + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz", + "integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==", "dev": true } } @@ -1292,9 +1292,9 @@ }, "dependencies": { "tslib": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", - "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==", + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz", + "integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==", "dev": true } } @@ -1309,9 +1309,9 @@ }, "dependencies": { "tslib": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", - "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==", + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz", + "integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==", "dev": true } } @@ -1385,9 +1385,9 @@ } }, "tslib": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", - "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==", + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz", + "integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==", "dev": true } } @@ -1407,9 +1407,9 @@ }, "dependencies": { "tslib": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", - "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==", + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz", + "integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==", "dev": true } } @@ -1425,9 +1425,9 @@ }, "dependencies": { "tslib": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", - "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==", + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz", + "integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==", "dev": true } } @@ -5259,9 +5259,9 @@ "dev": true }, "@types/node": { - "version": "18.11.4", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.4.tgz", - "integrity": "sha512-BxcJpBu8D3kv/GZkx/gSMz6VnTJREBj/4lbzYOQueUOELkt8WrO6zAcSPmp9uRPEW/d+lUO8QK0W2xnS1hEU0A==", + "version": "18.11.9", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.9.tgz", + "integrity": "sha512-CRpX21/kGdzjOpFsZSkcrXMGIBWMGNIHXXBVFSH+ggkftxg+XYP20TESbh+zFvFj3EQOl5byk0HTRn1IL6hbqg==", "dev": true }, "@types/normalize-package-data": { @@ -5341,6 +5341,16 @@ "integrity": "sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==", "dev": true }, + "@types/yauzl": { + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.10.0.tgz", + "integrity": "sha512-Cn6WYCm0tXv8p6k+A8PvbDG763EDpBoTzHdA+Q/MF6H3sapGjCm9NzoaJncJS9tUKSuCoDs9XHxYYsQDgxR6kw==", + "dev": true, + "optional": true, + "requires": { + "@types/node": "*" + } + }, "JSONStream": { "version": "1.3.5", "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.5.tgz", @@ -6044,13 +6054,13 @@ "babel-helper-mark-eval-scopes": { "version": "0.4.3", "resolved": "https://registry.npmjs.org/babel-helper-mark-eval-scopes/-/babel-helper-mark-eval-scopes-0.4.3.tgz", - "integrity": "sha1-0kSjvvmESHJgP/tG4izorN9VFWI=", + "integrity": "sha512-+d/mXPP33bhgHkdVOiPkmYoeXJ+rXRWi7OdhwpyseIqOS8CmzHQXHUp/+/Qr8baXsT0kjGpMHHofHs6C3cskdA==", "dev": true }, "babel-helper-remove-or-void": { "version": "0.4.3", "resolved": "https://registry.npmjs.org/babel-helper-remove-or-void/-/babel-helper-remove-or-void-0.4.3.tgz", - "integrity": "sha1-pPA7QAd6D/6I5F0HAQ3uJB/1rmA=", + "integrity": "sha512-eYNceYtcGKpifHDir62gHJadVXdg9fAhuZEXiRQnJJ4Yi4oUTpqpNY//1pM4nVyjjDMPYaC2xSf0I+9IqVzwdA==", "dev": true }, "babel-jest": { @@ -6149,9 +6159,9 @@ } }, "babel-plugin-minify-dead-code-elimination": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/babel-plugin-minify-dead-code-elimination/-/babel-plugin-minify-dead-code-elimination-0.5.1.tgz", - "integrity": "sha512-x8OJOZIrRmQBcSqxBcLbMIK8uPmTvNWPXH2bh5MDCW1latEqYiRMuUkPImKcfpo59pTUB2FT7HfcgtG8ZlR5Qg==", + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/babel-plugin-minify-dead-code-elimination/-/babel-plugin-minify-dead-code-elimination-0.5.2.tgz", + "integrity": "sha512-krq9Lwi0QIzyAlcNBXTL4usqUvevB4BzktdEsb8srcXC1AaYqRJiAQw6vdKdJSaXbz6snBvziGr6ch/aoRCfpA==", "dev": true, "requires": { "babel-helper-evaluate-path": "^0.5.0", @@ -6312,6 +6322,29 @@ "file-uri-to-path": "1.0.0" } }, + "bl": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", + "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", + "dev": true, + "requires": { + "buffer": "^5.5.0", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + }, + "dependencies": { + "buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "dev": true, + "requires": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + } + } + }, "bluebird": { "version": "3.7.2", "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", @@ -6690,6 +6723,12 @@ "ieee754": "^1.1.4" } }, + "buffer-crc32": { + "version": "0.2.13", + "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", + "integrity": "sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==", + "dev": true + }, "buffer-equal": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/buffer-equal/-/buffer-equal-1.0.0.tgz", @@ -6979,6 +7018,12 @@ } } }, + "chownr": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", + "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==", + "dev": true + }, "ci-info": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", @@ -7629,6 +7674,15 @@ "cross-spawn": "^7.0.1" } }, + "cross-fetch": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.5.tgz", + "integrity": "sha512-lvb1SBsI0Z7GDwmuid+mU3kWVBwTVUbe7S0H52yaaAdQOXq2YktTCZdlAcNKFzE6QtRz0snpw9bNiPeOIkkQvw==", + "dev": true, + "requires": { + "node-fetch": "2.6.7" + } + }, "cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", @@ -8203,6 +8257,12 @@ "minimist": "^1.2.6" } }, + "devtools-protocol": { + "version": "0.0.1056733", + "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1056733.tgz", + "integrity": "sha512-CmTu6SQx2g3TbZzDCAV58+LTxVdKplS7xip0g5oDXpZ+isr0rv5dDP8ToyVRywzPHkCCPKgKgScEcwz4uPWDIA==", + "dev": true + }, "diff-sequences": { "version": "24.9.0", "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-24.9.0.tgz", @@ -9333,6 +9393,29 @@ } } }, + "extract-zip": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-2.0.1.tgz", + "integrity": "sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg==", + "dev": true, + "requires": { + "@types/yauzl": "^2.9.1", + "debug": "^4.1.1", + "get-stream": "^5.1.0", + "yauzl": "^2.10.0" + }, + "dependencies": { + "get-stream": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", + "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", + "dev": true, + "requires": { + "pump": "^3.0.0" + } + } + } + }, "extsprintf": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", @@ -9406,6 +9489,15 @@ "bser": "2.1.1" } }, + "fd-slicer": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", + "integrity": "sha512-cE1qsB/VwyQozZ+q1dGxR8LBYNZeofhEdUNGSMbQD3Gw2lAzX9Zb3uIU6Ebc/Fmyjo9AWWfnn0AUCHqtevs/8g==", + "dev": true, + "requires": { + "pend": "~1.2.0" + } + }, "fecha": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/fecha/-/fecha-4.2.3.tgz", @@ -9898,6 +9990,12 @@ "integrity": "sha512-cHEpEQHUg0f8XdtZCc2ZAhrHzKzT0MrFUTcvx+hfxYu7rGMDc5SKoXFh+n4YigxsHXRzc6OrCshdR1bWH6HHyg==", "dev": true }, + "fs-constants": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", + "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==", + "dev": true + }, "fs-extra": { "version": "10.1.0", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", @@ -10423,9 +10521,9 @@ }, "dependencies": { "tslib": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", - "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==", + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz", + "integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==", "dev": true } } @@ -13797,15 +13895,15 @@ } }, "jwks-rsa": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/jwks-rsa/-/jwks-rsa-2.1.4.tgz", - "integrity": "sha512-mpArfgPkUpX11lNtGxsF/szkasUcbWHGplZl/uFvFO2NuMHmt0dQXIihh0rkPU2yQd5niQtuUHbXnG/WKiXF6Q==", + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/jwks-rsa/-/jwks-rsa-2.1.5.tgz", + "integrity": "sha512-IODtn1SwEm7n6GQZnQLY0oxKDrMh7n/jRH1MzE8mlxWMrh2NnMyOsXTebu8vJ1qCpmuTJcL4DdiE0E4h8jnwsA==", "dev": true, "requires": { - "@types/express": "^4.17.13", - "@types/jsonwebtoken": "^8.5.8", + "@types/express": "^4.17.14", + "@types/jsonwebtoken": "^8.5.9", "debug": "^4.3.4", - "jose": "^2.0.5", + "jose": "^2.0.6", "limiter": "^1.1.5", "lru-memoizer": "^2.1.4" } @@ -17902,8 +18000,8 @@ "dev": true }, "parse-server": { - "version": "git+https://github.com/parse-community/parse-server.git#b54af6b70105ea27974f788d47d57fee9f4ca91c", - "from": "git+https://github.com/parse-community/parse-server.git#b54af6b70105ea27974f788d47d57fee9f4ca91c", + "version": "git+https://github.com/parse-community/parse-server.git#81304be649306708fe63a26ae828edcdf4d0ad17", + "from": "git+https://github.com/parse-community/parse-server.git#alpha", "dev": true, "requires": { "@graphql-tools/merge": "8.3.6", @@ -17914,11 +18012,11 @@ "@parse/fs-files-adapter": "1.2.2", "@parse/push-adapter": "4.1.2", "bcryptjs": "2.4.3", - "body-parser": "1.20.0", + "body-parser": "1.20.1", "commander": "5.1.0", "cors": "2.8.5", "deepcopy": "2.1.0", - "express": "4.18.1", + "express": "4.18.2", "follow-redirects": "1.15.2", "graphql": "16.6.0", "graphql-list-fields": "2.0.2", @@ -17926,7 +18024,7 @@ "graphql-tag": "2.12.6", "intersect": "1.0.1", "jsonwebtoken": "8.5.1", - "jwks-rsa": "2.1.4", + "jwks-rsa": "2.1.5", "ldapjs": "2.3.3", "lodash": "4.17.21", "lru-cache": "7.12.0", @@ -17938,7 +18036,7 @@ "pg-promise": "10.12.0", "pluralize": "8.0.0", "redis": "3.1.2", - "semver": "7.3.7", + "semver": "7.3.8", "subscriptions-transport-ws": "0.11.0", "tv4": "1.3.0", "uuid": "9.0.0", @@ -17948,9 +18046,9 @@ }, "dependencies": { "body-parser": { - "version": "1.20.0", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.0.tgz", - "integrity": "sha512-DfJ+q6EPcGKZD1QWUjSpqp+Q7bDQTsQIF4zfUAtZ6qk+H/3/QRhg9CEp39ss+/T2vw0+HaidC0ecJj/DRLIaKg==", + "version": "1.20.1", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz", + "integrity": "sha512-jWi7abTbYwajOytWCQc37VulmWiRae5RyTpaCyDcS5/lMdtwSz5lOpDE67srw/HYe35f1z3fDQw+3txg7gNtWw==", "dev": true, "requires": { "bytes": "3.1.2", @@ -17961,7 +18059,7 @@ "http-errors": "2.0.0", "iconv-lite": "0.4.24", "on-finished": "2.4.1", - "qs": "6.10.3", + "qs": "6.11.0", "raw-body": "2.5.1", "type-is": "~1.6.18", "unpipe": "1.0.0" @@ -18016,14 +18114,14 @@ "dev": true }, "express": { - "version": "4.18.1", - "resolved": "https://registry.npmjs.org/express/-/express-4.18.1.tgz", - "integrity": "sha512-zZBcOX9TfehHQhtupq57OF8lFZ3UZi08Y97dwFCkD8p9d/d2Y3M+ykKcwaMDEL+4qyUolgBDX6AblpR3fL212Q==", + "version": "4.18.2", + "resolved": "https://registry.npmjs.org/express/-/express-4.18.2.tgz", + "integrity": "sha512-5/PsL6iGPdfQ/lKM1UuielYgv3BUoJfz1aUwU9vHZ+J7gyvwdQXFEBIEIaxeGf0GIcreATNyBExtalisDbuMqQ==", "dev": true, "requires": { "accepts": "~1.3.8", "array-flatten": "1.1.1", - "body-parser": "1.20.0", + "body-parser": "1.20.1", "content-disposition": "0.5.4", "content-type": "~1.0.4", "cookie": "0.5.0", @@ -18042,7 +18140,7 @@ "parseurl": "~1.3.3", "path-to-regexp": "0.1.7", "proxy-addr": "~2.0.7", - "qs": "6.10.3", + "qs": "6.11.0", "range-parser": "~1.2.1", "safe-buffer": "5.2.1", "send": "0.18.0", @@ -18104,9 +18202,9 @@ } }, "qs": { - "version": "6.10.3", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.3.tgz", - "integrity": "sha512-wr7M2E0OFRfIfJZjKGieI8lBKb7fRCH4Fv5KNPEs7gJ8jadvotdsS08PzOKR7opXhZ/Xkjtt3WF9g38drmyRqQ==", + "version": "6.11.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", + "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==", "dev": true, "requires": { "side-channel": "^1.0.4" @@ -18131,9 +18229,9 @@ "dev": true }, "semver": { - "version": "7.3.7", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", - "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", + "version": "7.3.8", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", + "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", "dev": true, "requires": { "lru-cache": "^6.0.0" @@ -18329,6 +18427,12 @@ "sha.js": "^2.4.8" } }, + "pend": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", + "integrity": "sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==", + "dev": true + }, "performance-now": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", @@ -18733,6 +18837,12 @@ "ipaddr.js": "1.9.1" } }, + "proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", + "dev": true + }, "pseudomap": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", @@ -18806,6 +18916,46 @@ "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", "dev": true }, + "puppeteer": { + "version": "19.2.2", + "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-19.2.2.tgz", + "integrity": "sha512-m1T5Mog5qu5+dMBptWYTn6pXRdnFbydbVUCthqwbfd8/kOiMlzZBR9ywjX79LpvI1Sj+/z8+FKeIsjnMul8ZYA==", + "dev": true, + "requires": { + "cosmiconfig": "7.0.1", + "devtools-protocol": "0.0.1056733", + "https-proxy-agent": "5.0.1", + "progress": "2.0.3", + "proxy-from-env": "1.1.0", + "puppeteer-core": "19.2.2" + } + }, + "puppeteer-core": { + "version": "19.2.2", + "resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-19.2.2.tgz", + "integrity": "sha512-faojf+1pZ/tHXSr4x1q+9MVd9FrL3rpdbC0w7qN7MNClMoLuCvMbpR4vzcjoiJYgclt1n+SOPUOmHQViTw6frw==", + "dev": true, + "requires": { + "cross-fetch": "3.1.5", + "debug": "4.3.4", + "devtools-protocol": "0.0.1056733", + "extract-zip": "2.0.1", + "https-proxy-agent": "5.0.1", + "proxy-from-env": "1.1.0", + "rimraf": "3.0.2", + "tar-fs": "2.1.1", + "unbzip2-stream": "1.4.3", + "ws": "8.10.0" + }, + "dependencies": { + "ws": { + "version": "8.10.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.10.0.tgz", + "integrity": "sha512-+s49uSmZpvtAsd2h37vIPy1RBusaLawVe8of+GyEPsaJTCMpj/2v8NpeK1SHXjBlQ95lQTmQofOJnFiLoaN3yw==", + "dev": true + } + } + }, "q": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/q/-/q-1.5.1.tgz", @@ -21222,6 +21372,31 @@ "integrity": "sha1-fLy2S1oUG2ou/CxdLGe04VCyomg=", "dev": true }, + "tar-fs": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.1.tgz", + "integrity": "sha512-V0r2Y9scmbDRLCNex/+hYzvp/zyYjvFbHPNgVTKfQvVrb6guiE/fxP+XblDNR011utopbkex2nM4dHNV6GDsng==", + "dev": true, + "requires": { + "chownr": "^1.1.1", + "mkdirp-classic": "^0.5.2", + "pump": "^3.0.0", + "tar-stream": "^2.1.4" + } + }, + "tar-stream": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz", + "integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==", + "dev": true, + "requires": { + "bl": "^4.0.3", + "end-of-stream": "^1.4.1", + "fs-constants": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^3.1.1" + } + }, "teeny-request": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/teeny-request/-/teeny-request-6.0.1.tgz", @@ -21776,6 +21951,16 @@ "which-boxed-primitive": "^1.0.2" } }, + "unbzip2-stream": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.4.3.tgz", + "integrity": "sha512-mlExGW4w71ebDJviH16lQLtZS32VKqsSfk80GCfUlwT/4/hNRFsoscrF/c++9xinkMzECL1uL9DDwXqFWkruPg==", + "dev": true, + "requires": { + "buffer": "^5.2.1", + "through": "^2.3.8" + } + }, "unc-path-regex": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/unc-path-regex/-/unc-path-regex-0.1.2.tgz", @@ -22647,6 +22832,16 @@ "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", "dev": true }, + "yauzl": { + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", + "integrity": "sha512-p4a9I6X6nu6IhoGmBqAcbJy1mlC4j27vEPZX9F4L4/vZT3Lyq1VkFHw/V/PUcB9Buo+DG3iHkT0x3Qya58zc3g==", + "dev": true, + "requires": { + "buffer-crc32": "~0.2.3", + "fd-slicer": "~1.1.0" + } + }, "yocto-queue": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", diff --git a/package.json b/package.json index 6c8496c67..2ff097399 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "parse", - "version": "3.5.0", + "version": "3.5.1-beta.2", "description": "The Parse JavaScript SDK", "homepage": "https://parseplatform.org/", "keywords": [ @@ -56,7 +56,7 @@ "babel-eslint": "10.1.0", "babel-jest": "24.9.0", "babel-plugin-inline-package-json": "2.0.0", - "babel-plugin-minify-dead-code-elimination": "0.5.1", + "babel-plugin-minify-dead-code-elimination": "0.5.2", "babel-plugin-transform-inline-environment-variables": "0.4.3", "browserify": "16.5.1", "codecov": "3.7.1", @@ -84,6 +84,7 @@ "metro-react-native-babel-preset": "0.59.0", "parse-server": "git+https://github.com/parse-community/parse-server#alpha", "prettier": "2.2.1", + "puppeteer": "19.2.2", "regenerator-runtime": "0.13.5", "semantic-release": "19.0.3", "vinyl-source-stream": "2.0.0" diff --git a/src/ParseFile.js b/src/ParseFile.js index 197d8c046..08349f977 100644 --- a/src/ParseFile.js +++ b/src/ParseFile.js @@ -137,7 +137,10 @@ class ParseFile { } else if (data && typeof data.base64 === 'string') { const base64 = data.base64.split(',').slice(-1)[0]; const dataType = - specifiedType || data.base64.split(';').slice(0, 1)[0].split(':').slice(1, 2)[0] || 'text/plain'; + specifiedType || + data.base64.split(';').slice(0, 1)[0].split(':').slice(1, 2)[0] || + 'text/plain'; + this._data = base64; this._source = { format: 'base64', base64, diff --git a/src/StorageController.react-native.js b/src/StorageController.react-native.js index b6b8443c2..d3a99b85b 100644 --- a/src/StorageController.react-native.js +++ b/src/StorageController.react-native.js @@ -9,19 +9,14 @@ * @flow * @private */ - import CoreManager from './CoreManager'; const StorageController = { async: 1, - getAsyncStorage(): any { - return CoreManager.getAsyncStorage(); - }, - getItemAsync(path: string): Promise { return new Promise((resolve, reject) => { - this.getAsyncStorage().getItem(path, function (err, value) { + CoreManager.getAsyncStorage().getItem(path, (err, value) => { if (err) { reject(err); } else { @@ -33,7 +28,7 @@ const StorageController = { setItemAsync(path: string, value: string): Promise { return new Promise((resolve, reject) => { - this.getAsyncStorage().setItem(path, value, function (err, value) { + CoreManager.getAsyncStorage().setItem(path, value, (err, value) => { if (err) { reject(err); } else { @@ -45,7 +40,7 @@ const StorageController = { removeItemAsync(path: string): Promise { return new Promise((resolve, reject) => { - this.getAsyncStorage().removeItem(path, function (err) { + CoreManager.getAsyncStorage().removeItem(path, (err) => { if (err) { reject(err); } else { @@ -57,7 +52,7 @@ const StorageController = { getAllKeysAsync(): Promise { return new Promise((resolve, reject) => { - this.getAsyncStorage().getAllKeys(function (err, keys) { + CoreManager.getAsyncStorage().getAllKeys((err, keys) => { if (err) { reject(err); } else { @@ -69,7 +64,7 @@ const StorageController = { multiGet(keys: Array): Promise>> { return new Promise((resolve, reject) => { - this.getAsyncStorage().multiGet(keys, function (err, result) { + CoreManager.getAsyncStorage().multiGet(keys, (err, result) => { if (err) { reject(err); } else { @@ -81,7 +76,7 @@ const StorageController = { multiRemove(keys: Array): Promise { return new Promise((resolve, reject) => { - this.getAsyncStorage().multiRemove(keys, function (err) { + CoreManager.getAsyncStorage().multiRemove(keys, (err) => { if (err) { reject(err); } else { @@ -92,7 +87,7 @@ const StorageController = { }, clear() { - return this.getAsyncStorage().clear(); + return CoreManager.getAsyncStorage().clear(); }, }; diff --git a/src/__tests__/ParseFile-test.js b/src/__tests__/ParseFile-test.js index caab362a2..2e66ba19c 100644 --- a/src/__tests__/ParseFile-test.js +++ b/src/__tests__/ParseFile-test.js @@ -64,18 +64,21 @@ describe('ParseFile', () => { const file = new ParseFile('parse.txt', { base64: 'YWJj' }); expect(file._source.base64).toBe('YWJj'); expect(file._source.type).toBe('text/plain'); + expect(file._data).toBe('YWJj'); }); it('can create files with base64 encoding (1 padding)', () => { const file = new ParseFile('parse.txt', { base64: 'YWI=' }); expect(file._source.base64).toBe('YWI='); expect(file._source.type).toBe('text/plain'); + expect(file._data).toBe('YWI='); }); it('can create files with base64 encoding (2 padding)', () => { const file = new ParseFile('parse.txt', { base64: 'ParseA==' }); expect(file._source.base64).toBe('ParseA=='); expect(file._source.type).toBe('text/plain'); + expect(file._data).toBe('ParseA=='); }); it('can set the default type to be text/plain when using base64', () => { @@ -84,6 +87,7 @@ describe('ParseFile', () => { }); expect(file._source.base64).toBe('ParseA=='); expect(file._source.type).toBe('text/plain'); + expect(file._data).toBe('ParseA=='); }); it('can extract data type from base64', () => { @@ -92,6 +96,7 @@ describe('ParseFile', () => { }); expect(file._source.base64).toBe('ParseA=='); expect(file._source.type).toBe('image/png'); + expect(file._data).toBe('ParseA=='); }); it('can extract data type from base64 with a filename parameter', () => { @@ -100,6 +105,7 @@ describe('ParseFile', () => { }); expect(file._source.base64).toBe('ParseA=='); expect(file._source.type).toBe('application/pdf'); + expect(file._data).toBe('ParseA=='); }); it('can create files with file uri', () => { @@ -116,6 +122,7 @@ describe('ParseFile', () => { }); expect(file._source.base64).toBe('ParseA=='); expect(file._source.type).toBe('audio/m4a'); + expect(file._data).toBe('ParseA=='); }); it('can extract data type from base64 with a complex mime type', () => { @@ -124,6 +131,7 @@ describe('ParseFile', () => { }); expect(file._source.base64).toBe('ParseA=='); expect(file._source.type).toBe('application/vnd.google-earth.kml+xml'); + expect(file._data).toBe('ParseA=='); }); it('can extract data type from base64 with a charset param', () => { @@ -132,18 +140,21 @@ describe('ParseFile', () => { }); expect(file._source.base64).toBe('ParseA=='); expect(file._source.type).toBe('application/vnd.3gpp.pic-bw-var'); + expect(file._data).toBe('ParseA=='); }); it('can create files with byte arrays', () => { const file = new ParseFile('parse.txt', [61, 170, 236, 120]); expect(file._source.base64).toBe('ParseA=='); expect(file._source.type).toBe(''); + expect(file._data).toBe('ParseA=='); }); it('can create files with all types of characters', () => { const file = new ParseFile('parse.txt', [11, 239, 191, 215, 80, 52]); expect(file._source.base64).toBe('C++/11A0'); expect(file._source.type).toBe(''); + expect(file._data).toBe('C++/11A0'); }); it('can create an empty file', () => { @@ -341,6 +352,7 @@ describe('ParseFile', () => { const file = new ParseFile('parse.txt', [61, 170, 236, 120], '', metadata, tags); expect(file._source.base64).toBe('ParseA=='); expect(file._source.type).toBe(''); + expect(file._data).toBe('ParseA=='); expect(file.metadata()).toBe(metadata); expect(file.tags()).toBe(tags); });