Skip to content

Commit

Permalink
clear context before each test
Browse files Browse the repository at this point in the history
  • Loading branch information
tlgimenes committed Jun 2, 2022
1 parent 092c9a3 commit b7e65f6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
1 change: 0 additions & 1 deletion packages/api/test/mutations.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ beforeAll(async () => {
// the calls performed by each query independently.
beforeEach(() => {
mockedFetch.mockClear()

context = contextFactory({})
})

Expand Down
7 changes: 4 additions & 3 deletions packages/api/test/queries.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,14 @@ jest.mock('../src/platforms/vtex/clients/fetch.ts', () => ({

beforeAll(async () => {
schema = await getSchema(apiOptions)

context = contextFactory({})
})

// Always clear the mocked fetch before each test so we can count and validate
// the calls performed by each query independently.
beforeEach(() => mockedFetch.mockClear())
beforeEach(() => {
mockedFetch.mockClear()
context = contextFactory({})
})

test('`collection` query', async () => {
const fetchAPICalls = [
Expand Down

0 comments on commit b7e65f6

Please sign in to comment.