DEV Community


Posted on

3.0 release, work is not yet done

I exclusively worked on this issue this week #3464.

Update Feed in parser to use Supabase:

I basically removed all invalid and flagged feed from src/api/parser/utils/storage and create functions that would take care of invalidating/flagging feeds using Supabase in src/api/parser/utils/supabase.js. Looking back, it wasn't that hard but it was quite lengthy.

The difficulty was that this function uses isFlagged function to check flagged feed and now it talks to Supabase instead of Redis which made unit test not pass without mocking it.

  addFeed: async (feed) => {
    // Check if feed being added already exists in flagged feeds set
    // If it is, do nothing
    if (await isFlagged( return;

    const key = createFeedKey(;
    await redis
    // ...
Enter fullscreen mode Exit fullscreen mode

So I literally created a mock for Supabase database though I had a problem with telling Jest to use the mock module.

Originally, I imported the mock this way

const { __setMockFeeds, __resetMockFeeds } = require('../src/__mocks__/utils/supabase');
Enter fullscreen mode Exit fullscreen mode

So, __setMockFeeds would add the array to the actual module => not the mock factory that Jest uses. Those 2 are different javascript objects and Jerry helped me understand this.

// Correct way to mock
const { __setMockFeeds, __resetMockFeeds } = require('../src/utils/supabase');
Enter fullscreen mode Exit fullscreen mode

I also had to reworked the parser e2e test, now it looks even simpler. For some reason, I kept forgetting to do pnpm migrate and I was stuck on the test for a while. I managed to make it work a few hours before 3.0 release haha.

However, work is not yet done, Supabase doesn't really work in production, parser can't really talk to the database, I hope to fix this soon and earn myself some peace of mind.

Top comments (0)