Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slightly improved tests for loadRange method #387

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

bijela-gora
Copy link
Contributor

This PR is more a question then a suggestion.

The question: should we care about an order in which StorageAdapterInterface.loadRange returns data?

When I utilized expect.arrayContaining in this commit bijela-gora@3238d7a to automerge-repo I'm sure I didn't consider that. Now, I'm not even sure why I used that asymmetric matcher. The expect.arrayContaining does not care about an order of elements inside arrays:

describe('expect.arrayContaining', () => {
	it("doesn't care about order", () => {
		expect([0, 1, 2]).toEqual(expect.arrayContaining([2, 0]))
	})
})

I noticed that a day ago when I was trying to make a storage adapter based on node:sqlite. For some reasons better-sqlite3 and node:sqlite for the same SQL statement returns results ordered differently. I tested that with latest version of better-sqlite3 and with latest Node.js because latest versions uses the same SQLite version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant