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
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)

sbot.close(true, t.end);
}),
);
Expand All @@ -91,9 +91,9 @@ test('word prefix', (t) => {
t.false(/\blabo\b/i.test(msg.value.content.text), 'labo is not found');
const matches = [...msg.value.content.text.matchAll(/labo/gi)];
t.true(msg.value.content.text.includes('labo'), 'labo prefix is found');
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');
Comment on lines -94 to +96
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 🤷

setTimeout(()=> {
sbot.close(true, t.end);
},1000)
Expand Down
Loading