ChicoState / ChicoState/pricecheck
Fix the last 4 tests that are failing
- Dominant language
- JavaScript
- Stars
- 1
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
1. The test `should handle missing price elements` in [content-price.test.js](cci:7://file:///Users/admin/Desktop/CSCI430/pricecheck/__tests__/content-price.test.js:0:0-0:0) is failing because the extracted price doesn't match the expected value. The test expects "Price not found" to be returned when no price element is present, but the current implementation returns something else or fails to extract any value.
## Related Test
```js
test('should handle missing price elements', () => {
document.body.innerHTML = '
require('../content-price.js');
expect(chrome.runtime.sendMessage).toHaveBeenCalledWith(
expect.objectContaining({
data: expect.objectContaining({
price: 'Price not found',
// other expected values...
})
}),
expect.any(Function)
);
});
2. ## Problem
The test for extracting product titles is failing. The implementation isn't reliably extracting the expected title from the page.
## Failing Test
Test: `should extract product title when available` in [content-price.test.js]
## Error Details
The test expects the title to be extracted correctly when present in a `` tag, but the expectation is failing.
## Root Cause
The title extraction logic in `extractProductData()` may not be correctly prioritizing title sources or handling document.title correctly in the JSDOM environment.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with __tests__/content-price.test.js and content-price.js, focusing on the missing-price test and extractProductData() title handling. Run the related tests, then verify that missing prices produce "Price not found" and available document titles are included in the message data.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend, testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100