mirror of
				https://github.com/mastermindzh/rickvanlieshout.com
				synced 2025-11-04 02:29:46 +01:00 
			
		
		
		
	chore: update mocks, move configs to jest dir
This commit is contained in:
		
							
								
								
									
										3
									
								
								jest/__mocks__/fileMock.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								jest/__mocks__/fileMock.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,3 @@
 | 
			
		||||
'use strict';
 | 
			
		||||
 | 
			
		||||
module.exports = 'file';
 | 
			
		||||
							
								
								
									
										29
									
								
								jest/__mocks__/gatsby.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								jest/__mocks__/gatsby.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,29 @@
 | 
			
		||||
'use strict';
 | 
			
		||||
 | 
			
		||||
const React = require('react');
 | 
			
		||||
 | 
			
		||||
const gatsby = jest.requireActual('gatsby');
 | 
			
		||||
 | 
			
		||||
module.exports = {
 | 
			
		||||
  ...gatsby,
 | 
			
		||||
  graphql: jest.fn(),
 | 
			
		||||
  Link: jest.fn().mockImplementation(
 | 
			
		||||
    ({
 | 
			
		||||
      activeClassName,
 | 
			
		||||
      activeStyle,
 | 
			
		||||
      getProps,
 | 
			
		||||
      innerRef,
 | 
			
		||||
      ref,
 | 
			
		||||
      replace,
 | 
			
		||||
      to,
 | 
			
		||||
      ...rest
 | 
			
		||||
    }) => (
 | 
			
		||||
      React.createElement('a', {
 | 
			
		||||
        ...rest,
 | 
			
		||||
        href: to,
 | 
			
		||||
      })
 | 
			
		||||
    )
 | 
			
		||||
  ),
 | 
			
		||||
  StaticQuery: jest.fn(),
 | 
			
		||||
  useStaticQuery: jest.fn(),
 | 
			
		||||
};
 | 
			
		||||
							
								
								
									
										22
									
								
								jest/jest-config.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								jest/jest-config.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,22 @@
 | 
			
		||||
'use strict';
 | 
			
		||||
 | 
			
		||||
module.exports = {
 | 
			
		||||
  rootDir: '../',
 | 
			
		||||
  transform: {
 | 
			
		||||
    '^.+\\.js?$': '<rootDir>/tests/jest-preprocess.js'
 | 
			
		||||
  },
 | 
			
		||||
  testMatch: ['**/__tests__/**/*.js', '**/?(*.)test.js'],
 | 
			
		||||
  moduleNameMapper: {
 | 
			
		||||
    '.+\\.(css|styl|less|sass|scss)$': 'identity-obj-proxy',
 | 
			
		||||
    '.+\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': '<rootDir>/tests/__mocks__/fileMock.js'
 | 
			
		||||
  },
 | 
			
		||||
  testPathIgnorePatterns: ['node_modules', '.cache', 'public'],
 | 
			
		||||
  transformIgnorePatterns: [
 | 
			
		||||
    'node_modules/(?!(gatsby)/)'
 | 
			
		||||
  ],
 | 
			
		||||
  globals: {
 | 
			
		||||
    __PATH_PREFIX__: ''
 | 
			
		||||
  },
 | 
			
		||||
  testURL: 'http://localhost/',
 | 
			
		||||
  setupFiles: ['<rootDir>/tests/loadershim.js']
 | 
			
		||||
};
 | 
			
		||||
							
								
								
									
										16
									
								
								jest/jest-preprocess.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								jest/jest-preprocess.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,16 @@
 | 
			
		||||
'use strict';
 | 
			
		||||
 | 
			
		||||
const babelOptions = {
 | 
			
		||||
  presets: [
 | 
			
		||||
    '@babel/react',
 | 
			
		||||
    '@babel/env',
 | 
			
		||||
    'babel-preset-gatsby'
 | 
			
		||||
  ],
 | 
			
		||||
  plugins: [
 | 
			
		||||
    '@babel/plugin-proposal-optional-chaining',
 | 
			
		||||
    '@babel/plugin-proposal-class-properties',
 | 
			
		||||
    '@babel/plugin-transform-flow-strip-types',
 | 
			
		||||
  ],
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
module.exports = require('babel-jest').createTransformer(babelOptions);
 | 
			
		||||
							
								
								
									
										5
									
								
								jest/loadershim.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								jest/loadershim.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,5 @@
 | 
			
		||||
'use strict';
 | 
			
		||||
 | 
			
		||||
global.___loader = {
 | 
			
		||||
  enqueue: jest.fn(),
 | 
			
		||||
};
 | 
			
		||||
		Reference in New Issue
	
	Block a user