Is there a way to dynamically update a next/router/
jest.mock query?
I am essentially trying to mock a different query depending on the tests that are run.
i.e.
jest.mock('next/router', () => ({
useRouter() {
return {
query: {
'block-number': ['block', '1']
}
};
}
}));
describe('test block 1 ', () => {
test('Renders block 1', async () => {
});
});
The above mock should be run for describe block 1
and then mock should be updated to run the block 2 with different a different query i.e.
jest.mock('next/router', () => ({
useRouter() {
return {
query: {
'block-number': ['block', '2']
}
};
}
}));
describe('test block 2 ', () => {
test('Renders block 2', async () => {
});
});
so essentially I want to be able to update the query in the jest.mock