Skip to content

Commit 3181eee

Browse files
ci: apply automated fixes
1 parent 7bfa01d commit 3181eee

4 files changed

Lines changed: 22 additions & 22 deletions

File tree

.changeset/deterministic-collection-ordering.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
"@tanstack/db": patch
2+
'@tanstack/db': patch
33
---
44

55
Ensure deterministic iteration order for collections and indexes.

packages/db/src/SortedMap.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { compareKeys } from "@tanstack/db-ivm"
1+
import { compareKeys } from '@tanstack/db-ivm'
22

33
/**
44
* A Map implementation that keeps its entries sorted based on a comparator function

packages/db/tests/deterministic-ordering.test.ts

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { describe, expect, it } from "vitest"
2-
import { SortedMap } from "../src/SortedMap"
3-
import { BTreeIndex } from "../src/indexes/btree-index"
4-
import { createCollection } from "../src/collection/index.js"
5-
import { PropRef } from "../src/query/ir"
6-
import { mockSyncCollectionOptions } from "./utils"
1+
import { describe, expect, it } from 'vitest'
2+
import { SortedMap } from '../src/SortedMap'
3+
import { BTreeIndex } from '../src/indexes/btree-index'
4+
import { createCollection } from '../src/collection/index.js'
5+
import { PropRef } from '../src/query/ir'
6+
import { mockSyncCollectionOptions } from './utils'
77

88
/**
99
* These tests verify deterministic ordering behavior when values compare as equal.
@@ -19,7 +19,7 @@ describe(`Deterministic Ordering`, () => {
1919
it(`should maintain deterministic order when values are equal`, () => {
2020
// All values are the same (priority = 1), so they compare as equal
2121
const map = new SortedMap<string, { priority: number }>(
22-
(a, b) => a.priority - b.priority
22+
(a, b) => a.priority - b.priority,
2323
)
2424

2525
// Insert in "random" order
@@ -34,7 +34,7 @@ describe(`Deterministic Ordering`, () => {
3434

3535
it(`should maintain deterministic order with mixed equal and different values`, () => {
3636
const map = new SortedMap<string, { priority: number }>(
37-
(a, b) => a.priority - b.priority
37+
(a, b) => a.priority - b.priority,
3838
)
3939

4040
// Mix of equal and different priorities
@@ -51,7 +51,7 @@ describe(`Deterministic Ordering`, () => {
5151

5252
it(`should maintain deterministic order with numeric keys`, () => {
5353
const map = new SortedMap<number, { priority: number }>(
54-
(a, b) => a.priority - b.priority
54+
(a, b) => a.priority - b.priority,
5555
)
5656

5757
map.set(30, { priority: 1 })
@@ -64,7 +64,7 @@ describe(`Deterministic Ordering`, () => {
6464

6565
it(`should maintain deterministic order after updates`, () => {
6666
const map = new SortedMap<string, { priority: number }>(
67-
(a, b) => a.priority - b.priority
67+
(a, b) => a.priority - b.priority,
6868
)
6969

7070
map.set(`c`, { priority: 1 })
@@ -80,7 +80,7 @@ describe(`Deterministic Ordering`, () => {
8080

8181
it(`should maintain deterministic order after delete and re-insert`, () => {
8282
const map = new SortedMap<string, { priority: number }>(
83-
(a, b) => a.priority - b.priority
83+
(a, b) => a.priority - b.priority,
8484
)
8585

8686
map.set(`c`, { priority: 1 })
@@ -113,7 +113,7 @@ describe(`Deterministic Ordering`, () => {
113113
const index = new BTreeIndex<string>(
114114
1,
115115
new PropRef([`priority`]),
116-
`priority_index`
116+
`priority_index`,
117117
)
118118

119119
// All have same priority
@@ -130,7 +130,7 @@ describe(`Deterministic Ordering`, () => {
130130
const index = new BTreeIndex<string>(
131131
1,
132132
new PropRef([`priority`]),
133-
`priority_index`
133+
`priority_index`,
134134
)
135135

136136
index.add(`d`, { priority: 2 })
@@ -148,7 +148,7 @@ describe(`Deterministic Ordering`, () => {
148148
const index = new BTreeIndex<number>(
149149
1,
150150
new PropRef([`priority`]),
151-
`priority_index`
151+
`priority_index`,
152152
)
153153

154154
index.add(30, { priority: 1 })
@@ -163,7 +163,7 @@ describe(`Deterministic Ordering`, () => {
163163
const index = new BTreeIndex<string>(
164164
1,
165165
new PropRef([`priority`]),
166-
`priority_index`
166+
`priority_index`,
167167
)
168168

169169
index.add(`c`, { priority: 1 })
@@ -179,7 +179,7 @@ describe(`Deterministic Ordering`, () => {
179179
const index = new BTreeIndex<string>(
180180
1,
181181
new PropRef([`priority`]),
182-
`priority_index`
182+
`priority_index`,
183183
)
184184

185185
index.add(`c`, { priority: 1 })
@@ -197,7 +197,7 @@ describe(`Deterministic Ordering`, () => {
197197
const index = new BTreeIndex<string>(
198198
1,
199199
new PropRef([`priority`]),
200-
`priority_index`
200+
`priority_index`,
201201
)
202202

203203
// Add keys with different priorities

packages/powersync-db-collection/tests/powersync.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ describe(`PowerSync Integration`, () => {
113113
expect(collection.size).toBe(4)
114114
// Sort by name since keys are random UUIDs
115115
expect(
116-
collection.toArray.map((entry) => entry.name).sort()
116+
collection.toArray.map((entry) => entry.name).sort(),
117117
).deep.equals([`four`, `one`, `three`, `two`])
118118
},
119119
{ timeout: 1000 },
@@ -130,7 +130,7 @@ describe(`PowerSync Integration`, () => {
130130
expect(collection.size).toBe(3)
131131
// Sort by name since keys are random UUIDs
132132
expect(
133-
collection.toArray.map((entry) => entry.name).sort()
133+
collection.toArray.map((entry) => entry.name).sort(),
134134
).deep.equals([`four`, `one`, `three`])
135135
},
136136
{ timeout: 1000 },
@@ -148,7 +148,7 @@ describe(`PowerSync Integration`, () => {
148148
expect(collection.size).toBe(3)
149149
// Sort by name since keys are random UUIDs
150150
expect(
151-
collection.toArray.map((entry) => entry.name).sort()
151+
collection.toArray.map((entry) => entry.name).sort(),
152152
).deep.equals([`four`, `three`, `updated`])
153153
},
154154
{ timeout: 1000 },

0 commit comments

Comments
 (0)