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

Adjust tests to new fixtures #4

Merged
merged 1 commit into from
Jan 24, 2024
Merged

Adjust tests to new fixtures #4

merged 1 commit into from
Jan 24, 2024

Conversation

Powersource
Copy link
Contributor

@Powersource Powersource commented Jan 22, 2024

Fixes #3

So I did https://github.com/ssbc/ssb-search2/pull/2/files and there were failing tests in ci but i was like pfft silly CI. Turns out my machine didn't get the new, different fixtures (had to upgrade ssb-fixtures because of rsjs). So this PR adjusts the tests to actually pass with the new fixtures

@@ -69,7 +69,7 @@ test('exact chain-of-words', (t) => {
pull.filter((msg) => msg.value.content.text.toLowerCase().includes(INPUT)),
pull.collect((err, msgs) => {
t.error(err, 'no error');
t.equals(msgs.length, 4, 'four posts');
t.equals(msgs.length, 2, 'two posts');
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

% rg -a 'labore officia exercitation' /tmp/ssb-search2/flume/log.offset|wc -l
2

(there are multiple messages on each line but i verified by looking at the results in less)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tried finding a search with a few more results but i could only find searches with either 1-2 results or like 30+ (which would be harder to verify)

Comment on lines -94 to +96
t.equals(matches.length, 3, '3 matches');
t.equals(matches.length, 2, '2 matches');
const matchPositions = matches.map((m) => m.index);
t.deepEquals(matchPositions, [47, 55, 168], 'labo positions found');
t.deepEquals(matchPositions, [160, 168], 'labo positions found');
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think this is the message it's running on

{"key":"%rEpV0vnOoBuO01jmBb90H4Af/FmxTasGV0+otihgN8s=.sha256","value":{"previous":null,"sequence":1,"author":"@J74J+ctsqJNREBjVqvc/oeSVWNRrGcrfH54ERGQtqwI=.ed25519","timestamp":17059425
45831,"hash":"sha256","content":{"type":"post","text":"OLDESTMSG reprehenderit officia ad","c
hannel":"mollit","mentions":[{"link":"@3rJVBV5zDW8wgCEjAHBgNAkiE2c+HJf2XIsU6aND3Z8=.ed25519","name":"laborum laboris reprehenderit"},{"link":"&ZGVzZXJ1bnRsYWJvcmVvY2NhZWNhdGR1aXNuaXNpZXg=.sha256","type":"image/png","size":1220163},{"link":"@n7mkSt+3MKjSP5S8R6lJx2ixZKefldZ8GuyyBbtNCY4=.ed25519","name":"magna est"},{"link":"@QxRm+ZF6ZmZtMRDbdTvSL5FVG8XjiP0m5qHqRnSIacI=.ed25519","name":"nostrud"}]},"signature":"BAiI3JmQM7ZVkZbQdvLvHIFTgM2zltmUHzcxRF9kkQpLPcKvSTbbaH67Hl0i1XHBgb5vzNUltDoV57iRMjzaAA==.sig.ed25519"},"timestamp":1705942545832}

the matching text seems to be at sort of 160 and 168 chars into the content so it's probably ok? this is a bit more of a hunch on my part, idk exactly what .index is.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know either what's going on, but it's fine by me 🤷

@Powersource Powersource requested a review from staltz January 22, 2024 17:10
Copy link
Member

@staltz staltz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good :)

You can now merge yourself, and npm publish (although in this case not applicable).

@Powersource Powersource merged commit 030432d into main Jan 24, 2024
4 checks passed
@Powersource Powersource deleted the new-fixtures-fix branch January 24, 2024 17:04
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.

A test flaking
2 participants