ubiquity / scraper-kernel

A Puppeteer-based scraping platform with modular, page-level scraping logic.
0 stars 3 forks source link

Add Jest for Unit Testing #6

Closed 0x4007 closed 1 year ago

0x4007 commented 1 year ago

This will be used in other repos. Set up Jest to run and report tests.

seprintour commented 1 year ago

So we set up jest on the repo code and run it on github when an issue is open? @pavlovcik

ubiquibot[bot] commented 1 year ago

Available commands

- /assign: Assign the origin sender to the issue automatically.
- /unassign: Unassign the origin sender from the issue automatically.
- /help: List all available commands.
- /payout: Disable automatic payment for the issue.
- /wallet: <WALLET_ADDRESS | ENS_NAME>: Register the hunter's wallet address. 
  ex1: /wallet 0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266 
  ex2: /wallet vitalik.eth

@seprintour

ubiquibot[bot] commented 1 year ago

Available commands

- /assign: Assign the origin sender to the issue automatically.
- /unassign: Unassign the origin sender from the issue automatically.
- /help: List all available commands.
- /payout: Disable automatic payment for the issue.
- /wallet: <WALLET_ADDRESS | ENS_NAME>: Register the hunter's wallet address. 
  ex1: /wallet 0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266 
  ex2: /wallet vitalik.eth

@seprintour

seprintour commented 1 year ago

/help

ubiquibot[bot] commented 1 year ago

Available commands

- /assign: Assign the origin sender to the issue automatically.
- /unassign: Unassign the origin sender from the issue automatically.
- /help: List all available commands.
- /payout: Disable automatic payment for the issue.
- /wallet: <WALLET_ADDRESS | ENS_NAME>: Register the hunter's wallet address. 
  ex1: /wallet 0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266 
  ex2: /wallet vitalik.eth
0x4007 commented 1 year ago

Yeah we need automated tests. This bounty is strictly just to set up jest locally. We can make new bounties later for CI.

My expectation is that you will need to test basic functionality of this, like a few tests to check if it can return results from a page, but at the same time I fear that it will take some time to become familiar with how to use this tool. I don't believe I wrote any documentation around it, and it's a pretty complex codebase.

Starting collaboration with other developers will force me to write documentation which will move things forward in the right direction.

seprintour commented 1 year ago

Yeah we need automated tests. This bounty is strictly just to set up jest locally. We can make new bounties later for CI.

My expectation is that you will need to test basic functionality of this, like a few tests to check if it can return results from a page, but at the same time I fear that it will take some time to become familiar with how to use this tool. I don't believe I wrote any documentation around it, and it's a pretty complex codebase.

Starting collaboration with other developers will force me to write documentation which will move things forward in the right direction.

So we'd have go through this issue slowly, shouldn't be too hard for me to get a grasp of.. with your help it'd make it even faster

0x4007 commented 1 year ago

I think for now try and get familiar with the code and start writing very simple tests. It will force you to set up jest and its infrastructure.

For context on how to actually use this codebase

Right now I use this repository as a submodule in a parent "scraper" project. In the future, I would like for it to be an npm module. I then import it, and pass in a "pages" directory which dynamically imports logic based on the file structure. For example if scraping GitHub.com then the logic would be in a directory called GitHub.com/index.ts

The interesting part about this feature is that it works arbitrarily deep. For example I could make a file called GitHub.com/ubiquity/*/discussions/index.ts and it will automatically be imported when the browser navigates to any of our discussions.

Example https://github.com/pavlovcik/scraper-parent-test/tree/main

0x4007 commented 1 year ago

Once the initial jest infrastructure is set up we can make more bounties to write specific types of tests.

molecula451 commented 1 year ago

/assign

ubiquibot[bot] commented 1 year ago

@molecula451 The time limit for this bounty is on Mon, 19 Jun 2023 22:47:44 GMT

Your currently set address is: 0x4D0704f400D57Ba93eEa88765C3FcDBD826dCFc4 please use /wallet 0x4FDE...BA18 if you want to update it.

molecula451 commented 1 year ago

Kindly use xDai for issuing after reviewing and merge

molecula451 commented 1 year ago

Member

https://github.com/ubiquity/scraper-kernel/pull/10

0x4007 commented 1 year ago

Kindly use xDai for issuing after reviewing and merge

We only support WXDAI, which is an ERC20 wrapped version.

ubiquibot[bot] commented 1 year ago

[ CLAIM 300 WXDAI ]

0x4D0704f4...D826dCFc4

molecula451 commented 1 year ago

Member

absolutely, WXDAI, thank you magnific friend