Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@logux/core

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@logux/core - npm Package Compare versions

Comparing version 0.8.0 to 0.8.1

77

each-store-check/index.js

@@ -1,3 +0,43 @@

import assert from 'assert'
/* c8 ignore start */
function ok(value) {
if (!value) {
throw new Error('Expected value to be truthy, but got false')
}
}
function deepEqual(a, b) {
if (a === b) {
return true
} else if (Array.isArray(a) && Array.isArray(b)) {
if (a.length !== b.length) {
return false
} else {
for (let i = 0; i < a.length; i++) {
if (!deepEqual(a[i], b[i])) return false
}
return true
}
} else if (typeof a === 'object' && typeof b === 'object') {
if (Object.keys(a).length !== Object.keys(b).length) {
return false
} else {
for (let i in a) {
if (!deepEqual(a[i], b[i])) return false
}
return true
}
} else {
return false
}
}
function equal(a, b) {
if (!deepEqual(a, b)) {
throw new Error(
`Expected ${JSON.stringify(a)} to equal ${JSON.stringify(b)}`
)
}
}
/* c8 ignore stop */
async function all(request, list) {

@@ -12,3 +52,3 @@ if (!list) list = []

let entries = await all(store.get(opts))
assert.deepStrictEqual(entries, list)
equal(entries, list)
}

@@ -32,3 +72,3 @@

let lastAdded = await store.getLastAdded()
assert.strictEqual(lastAdded, expected)
equal(lastAdded, expected)
}

@@ -38,3 +78,3 @@

let lastSynced = await store.getLastSynced()
assert.deepStrictEqual(lastSynced, {
equal(lastSynced, {
sent: expectedSent,

@@ -108,3 +148,3 @@ received: expectedRecieved

let added = await store.getLastAdded()
assert.ok(added)
ok(added)
await store.add({ type: 'A' }, { id: '1 n 0' })

@@ -118,3 +158,3 @@ await checkLastAdded(store, 1)

let result = await store.changeMeta('1 n 0', { a: 2, b: 2 })
assert.strictEqual(result, true)
equal(result, true)
await checkBoth(store, [

@@ -131,3 +171,3 @@ [{}, { id: '1 n 0', time: 1, added: 1, a: 2, b: 2, indexes: ['a'] }]

let result = await store.changeMeta('1 n 0', { a: 1 })
assert.strictEqual(result, false)
equal(result, false)
})

@@ -147,6 +187,3 @@

let result = await store.remove('1 node1 1')
assert.deepStrictEqual(result, [
{ type: '2' },
{ id: '1 node1 1', time: 2, added: 2 }
])
equal(result, [{ type: '2' }, { id: '1 node1 1', time: 2, added: 2 }])
await checkBoth(store, [

@@ -179,3 +216,3 @@ [{ type: '1' }, { id: '1 node1 0', time: 1, added: 1 }],

let result = await store.remove('2 n 0')
assert.strictEqual(result, false)
equal(result, false)
await check(store, { order: 'created' }, [

@@ -356,3 +393,3 @@ [{ type: 'A' }, { id: '1 n 0', time: 1, added: 1 }]

])
assert.deepStrictEqual(removed, ['1'])
equal(removed, ['1'])
await checkBoth(store, [

@@ -374,9 +411,9 @@ [{ type: '2' }, { added: 2, id: '2 n 0', time: 2, reasons: ['a'] }],

let [action1, meta1] = await store.byId('1 node 0')
assert.deepStrictEqual(action1, { type: 'A' })
assert.deepStrictEqual(meta1.time, 1)
equal(action1, { type: 'A' })
equal(meta1.time, 1)
let [action2] = await store.byId('1 node 2')
assert.deepStrictEqual(action2, { type: 'C' })
equal(action2, { type: 'C' })
let [action3, meta3] = await store.byId('2 node 1')
assert.deepStrictEqual(action3, null)
assert.deepStrictEqual(meta3, null)
equal(action3, null)
equal(meta3, null)
})

@@ -388,5 +425,5 @@

let meta1 = await store.add({ a: 1 }, { id, time: 1 })
assert.deepStrictEqual(meta1, { id, time: 1, added: 1 })
equal(meta1, { id, time: 1, added: 1 })
let meta2 = await store.add({ a: 2 }, { id, time: 2 })
assert.ok(!meta2)
ok(!meta2)
await checkBoth(store, [[{ a: 1 }, { id, time: 1, added: 1 }]])

@@ -393,0 +430,0 @@ })

{
"name": "@logux/core",
"version": "0.8.0",
"version": "0.8.1",
"description": "Logux core components",

@@ -5,0 +5,0 @@ "keywords": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc