This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
adsBlocked = async () => { | |
const testURL = | |
'https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js'; | |
const myInit = { | |
method: 'HEAD', | |
mode: 'no-cors', | |
}; | |
const myRequest = new Request(testURL, myInit); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Place in __mocks__/next/ | |
import React, { useState } from 'react'; | |
let route = ''; | |
// Set before running test | |
export const setRoute = _route => { | |
route = _route; | |
}; | |
/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @flow | |
import React from 'react'; | |
import styled from '@emotion/styled'; //or styled-components | |
export const Content = styled.span` | |
cursor: pointer; | |
display: flex; | |
align-content: center; | |
position: relative; | |
flex: 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// In case you are tired of seeing warning and error messages in your tests add these | |
// few lines of code to your setupTests.js file. | |
// | |
// Any test that outputs console.error or console.warn will fail allowing you to easily | |
// identify where the log came from so you can address it accordingly | |
const spyError = jest.spyOn(global.console, 'error'); | |
const spyWarn = jest.spyOn(global.console, 'warn'); | |
afterEach(() => { |