supabase-js icon indicating copy to clipboard operation
supabase-js copied to clipboard

chore: restructure `test` folder

Open Ananya2001-an opened this issue 1 year ago • 0 comments

Describe the chore

It would be good to have all the expected results (basically the constants created in each test file) defined in a separate file maybe something like: test/utils/constants.ts for better readability and maintainability. Actually we can do further more restructuring with the test folder; like right now we have a helper.test.ts and a helpers.test.ts file where both are testing the functions defined in lib/helpers.ts so why not do something like this:

.
├── test         
│   ├── utils 
│           ├── constants.ts      
│   ├──supabase        
│          └── helpers.test.ts
│          └── client.test.ts
│          └── ....
└── ...

Also the constants.test.ts file is just checking the type of the DEFAULT_HEADERS object which seems unnecessary so instead we can add a static type check like this:

export const DEFAULT_HEADERS: {[key: string]: string} = {
  'X-Client-Info': `supabase-js/${version}`,
};

Feel free to suggest anything you feel can be done to further improve this :)

Ananya2001-an avatar Jun 13 '23 13:06 Ananya2001-an