Skip to content

Commit

Permalink
fix superhero parser
Browse files Browse the repository at this point in the history
  • Loading branch information
thepiwo committed Nov 18, 2020
1 parent 7b8482d commit b65abca
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
1 change: 0 additions & 1 deletion config/regex-url-follow.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@
# CAREFUL TWO SPACES TO SPLIT
# CAREFUL ORDER IS IMPORTANT; FIRST WILL MATCH FIRST
(?<url>https:\/\/www.youtube.com\/watch\?v=[a-zA-Z0-9_-]+) #upload-info #channel-name a https://www.youtube.com
(?<url>https:\/\/superhero.com\/tip\/\d+(?:_v\d+)?) .site__url a
18 changes: 17 additions & 1 deletion test/pageParserTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,30 @@ describe('Page Parser', () => {

it('Follow Superhero Tip, Extract Original Creator', async () => {
const expectedAddress = "ak_2oBEG11B2GZSWVdVUQy1CYEvgWCfeizEGzjDaQB1YFv4owMcbd";
const url = "https://superhero.com/tip/2169_v1";
const url = "https://superhero.com/tip/1375_v1";

const result = await pageParser.getAddressFromPage(expectedAddress, url);
assert.equal(result, expectedAddress);
});

it('Follow Superhero Comment, Extract Original Creator', async () => {
const expectedAddress = "ak_2bP6pT5bKSkUpibFWAiv8hdgTgS854mhe3EAZh2i3hEyCY3Zno";
const url = "https://superhero.com/tip/1375_v1/comment/497";

const result = await pageParser.getAddressFromPage(expectedAddress, url);
assert.equal(result, expectedAddress);
});

it('Follow Superhero Tip, Extract Original Creator no Follow', async () => {
const expectedAddress = "ak_rRVV9aDnmmLriPePDSvfTUvepZtR2rbYk2Mx4GCqGLcc1DMAq";
const url = "https://superhero.com/tip/2169_v1";

const result = await pageParser.getAddressFromPage(expectedAddress, url);
assert.equal(result, expectedAddress);
});

it('Follow Superhero Comment, Extract Original Creator no Follow', async () => {
const expectedAddress = "ak_rRVV9aDnmmLriPePDSvfTUvepZtR2rbYk2Mx4GCqGLcc1DMAq";
const url = "https://superhero.com/tip/2170_v1";

const result = await pageParser.getAddressFromPage(expectedAddress, url);
Expand Down

0 comments on commit b65abca

Please sign in to comment.