From 3201f55eaf0ca46095bc4b8e423dabf0a2c83e99 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Thu, 3 Sep 2020 11:28:27 +0200 Subject: [PATCH 1/3] add some codestyle thoughts --- codestyle.md | 1 + 1 file changed, 1 insertion(+) diff --git a/codestyle.md b/codestyle.md index 1db6ad0f..e40da82e 100644 --- a/codestyle.md +++ b/codestyle.md @@ -5,3 +5,4 @@ otherwise synchronous errors can get swallowed - only named exports, no default exports otherwise it becomes hard to remember what was a default/named export + - should we return promises from storage mutation calls? probably not, as we don't await them anywhere. only read calls should return promises? From cbc3ae389170027291ddd00403c3625da73fddcb Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Thu, 3 Sep 2020 11:29:04 +0200 Subject: [PATCH 2/3] upgrade impunity to fix unit tests not loading lib/ as esm --- package.json | 4 ++-- yarn.lock | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index 09630651..2fc9bb5d 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "doc": "doc" }, "scripts": { - "test": "node_modules/.bin/impunity --entry-point src/main.js --force-esm", + "test": "node_modules/.bin/impunity --entry-point src/main.js --force-esm-dirs lib/ src/", "start": "node scripts/serve-local.js", "build": "node --experimental-modules scripts/build.mjs" }, @@ -32,7 +32,7 @@ "commander": "^6.0.0", "core-js": "^3.6.5", "finalhandler": "^1.1.1", - "impunity": "^0.0.12", + "impunity": "^1.0.0", "mdn-polyfills": "^5.20.0", "postcss": "^7.0.32", "postcss-css-variables": "^0.17.0", diff --git a/yarn.lock b/yarn.lock index a39eae81..22177c8e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -997,16 +997,16 @@ colors@^1.3.3: resolved "https://registry.yarnpkg.com/colors/-/colors-1.4.0.tgz#c50491479d4c1bdaed2c9ced32cf7c7dc2360f78" integrity sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA== -commander@^2.19.0: - version "2.20.3" - resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" - integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== - commander@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/commander/-/commander-6.0.0.tgz#2b270da94f8fb9014455312f829a1129dbf8887e" integrity sha512-s7EA+hDtTYNhuXkTlhqew4txMZVdszBmKWSPEMxGr8ru8JXR7bLUFIAtPhcSuFdJQ0ILMxnJi8GkQL0yvDy/YA== +commander@^6.1.0: + version "6.1.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-6.1.0.tgz#f8d722b78103141006b66f4c7ba1e97315ba75bc" + integrity sha512-wl7PNrYWd2y5mp1OK/LhTlv8Ff4kQJQRXXAvF+uU/TPNiVJUxZLRYGj/B0y/lPGAVcSbJqH2Za/cvHmrPMC8mA== + commondir@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/commondir/-/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b" @@ -1300,13 +1300,13 @@ http-errors@~1.7.2: statuses ">= 1.5.0 < 2" toidentifier "1.0.0" -impunity@^0.0.12: - version "0.0.12" - resolved "https://registry.yarnpkg.com/impunity/-/impunity-0.0.12.tgz#cb65316fe04eaf2bbd09ac23430cfdcf8e099ff5" - integrity sha512-XID4Ua0CGClVG/dN3jv2lftIIv4orXQ6iGNdqyU8yKKof6+Zp09BEo/XvOIWlRTO90GGINE88f6gx60yPdLvaQ== +impunity@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/impunity/-/impunity-1.0.0.tgz#041771ad0563902b3cc55d8adc8c8ea2d501aeb2" + integrity sha512-HYvRkcjl1PJKS6ti4M4abG0KT+zobPtm7fx3l6xMjZx/pleKYMH56y7fwy1cIbYbzo9fFFeSJ4H5VF6wBBHB9g== dependencies: colors "^1.3.3" - commander "^2.19.0" + commander "^6.1.0" inflight@^1.0.4: version "1.0.6" From 279b55e8e6c560bd804dc4da98df2bdca76dc9fc Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Thu, 3 Sep 2020 11:31:00 +0200 Subject: [PATCH 3/3] fix test --- src/matrix/Session.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/matrix/Session.js b/src/matrix/Session.js index 503ec3a5..2752fca7 100644 --- a/src/matrix/Session.js +++ b/src/matrix/Session.js @@ -301,7 +301,7 @@ export function tests() { } } }; - const newSessionData = session.writeSync("b", 6, {}, syncTxn); + const newSessionData = await session.writeSync({next_batch: "b"}, 6, {}, syncTxn); assert(syncSet); assert.equal(session.syncToken, "a"); assert.equal(session.syncFilterId, 5);