Skip to content

Commit

Permalink
fix: tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelmord committed Apr 8, 2020
1 parent fba2169 commit d2ca1ae
Show file tree
Hide file tree
Showing 8 changed files with 110 additions and 17 deletions.
38 changes: 38 additions & 0 deletions packages/design-system/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
const path = require('path');

module.exports = {
parser: '@typescript-eslint/parser', // Specifies the ESLint parser
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
'plugin:react/recommended',
'prettier/@typescript-eslint', // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier
'plugin:prettier/recommended', // Uses the recommended rules from the @typescript-eslint/eslint-plugin
],
parserOptions: {
ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features
sourceType: 'module', // Allows for the use of imports
ecmaFeatures: {
jsx: true, // Allows for the parsing of JSX
},
project: './tsconfig.json',
tsconfigRootDir: path.resolve(__dirname),
},
rules: {
"prettier/prettier": "error",
// Place to specify ESLint rules. Can be used to overwrite rules specified from the extended configs
// e.g. "@typescript-eslint/explicit-function-return-type": "off",
// "@typescript-eslint/no-unused-vars": "off"
},
settings: {
react: {
version: 'detect', // Tells eslint-plugin-react to automatically detect the version of React to use
},
},
env: {
browser: true,
node: true
}
};
9 changes: 9 additions & 0 deletions packages/design-system/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,14 @@
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^2.27.0",
"@typescript-eslint/parser": "^2.27.0",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.10.1",
"eslint-plugin-prettier": "^3.1.2",
"eslint-plugin-react": "^7.19.0",
"prettier": "^2.0.4"
}
}
6 changes: 3 additions & 3 deletions packages/design-system/src/App.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import React from 'react';
import { render } from '@testing-library/react';
import App from './App';

test('renders learn react link', () => {
test('renders hello headline', () => {
const { getByText } = render(<App />);
const linkElement = getByText(/learn react/i);
expect(linkElement).toBeInTheDocument();
const h1Element = getByText(/Hello/i);
expect(h1Element).toBeInTheDocument();
});
10 changes: 3 additions & 7 deletions packages/design-system/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
/** @jsx jsx */
import { jsx, Styled } from 'theme-ui'
import { jsx, Styled } from 'theme-ui';

function App() {
return (
<Styled.h1 className="App">
Hello!
</Styled.h1>
);
function App(): React.FC {
return <Styled.h1 className="App">Hello!!</Styled.h1>;
}

export default App;
3 changes: 1 addition & 2 deletions packages/design-system/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ console.info('Poolbase Design-System');
ReactDOM.render(
<React.StrictMode>
<ThemeProvider theme={poolbaseTheme}>
<App />
<App />
</ThemeProvider>
</React.StrictMode>,
document.getElementById('root')
);

6 changes: 6 additions & 0 deletions packages/design-system/src/setupTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,9 @@
// expect(element).toHaveTextContent(/react/i)
// learn more: https://github.com/testing-library/jest-dom
import '@testing-library/jest-dom/extend-expect';
import consola from 'consola';
beforeAll(() => {
// Redirect std and console to consola too
// Calling this once is sufficient
consola.wrapAll();
});
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@ export const pageCreateHandler = functions
try {
if (typeof page !== 'undefined' && typeof page.url !== 'undefined') {
const data = await scrapeHTML(page.url, context.params.pageId);
firestore
.collection('pages')
.doc(context.params.pageId)
.update(data);
firestore.collection('pages').doc(context.params.pageId).update(data);
}
} catch (e) {
console.log(e);
Expand Down
50 changes: 49 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3458,6 +3458,16 @@
regexpp "^3.0.0"
tsutils "^3.17.1"

"@typescript-eslint/eslint-plugin@^2.27.0":
version "2.27.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.27.0.tgz#e479cdc4c9cf46f96b4c287755733311b0d0ba4b"
integrity sha512-/my+vVHRN7zYgcp0n4z5A6HAK7bvKGBiswaM5zIlOQczsxj/aiD7RcgD+dvVFuwFaGh5+kM7XA6Q6PN0bvb1tw==
dependencies:
"@typescript-eslint/experimental-utils" "2.27.0"
functional-red-black-tree "^1.0.1"
regexpp "^3.0.0"
tsutils "^3.17.1"

"@typescript-eslint/experimental-utils@2.26.0":
version "2.26.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-2.26.0.tgz#063390c404d9980767d76274df386c0aa675d91d"
Expand All @@ -3468,6 +3478,16 @@
eslint-scope "^5.0.0"
eslint-utils "^2.0.0"

"@typescript-eslint/experimental-utils@2.27.0":
version "2.27.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-2.27.0.tgz#801a952c10b58e486c9a0b36cf21e2aab1e9e01a"
integrity sha512-vOsYzjwJlY6E0NJRXPTeCGqjv5OHgRU1kzxHKWJVPjDYGbPgLudBXjIlc+OD1hDBZ4l1DLbOc5VjofKahsu9Jw==
dependencies:
"@types/json-schema" "^7.0.3"
"@typescript-eslint/typescript-estree" "2.27.0"
eslint-scope "^5.0.0"
eslint-utils "^2.0.0"

"@typescript-eslint/parser@^2.10.0", "@typescript-eslint/parser@^2.19.1", "@typescript-eslint/parser@^2.19.2":
version "2.26.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-2.26.0.tgz#385463615818b33acb72a25b39c03579df93d76f"
Expand All @@ -3478,6 +3498,16 @@
"@typescript-eslint/typescript-estree" "2.26.0"
eslint-visitor-keys "^1.1.0"

"@typescript-eslint/parser@^2.27.0":
version "2.27.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-2.27.0.tgz#d91664335b2c46584294e42eb4ff35838c427287"
integrity sha512-HFUXZY+EdwrJXZo31DW4IS1ujQW3krzlRjBrFRrJcMDh0zCu107/nRfhk/uBasO8m0NVDbBF5WZKcIUMRO7vPg==
dependencies:
"@types/eslint-visitor-keys" "^1.0.0"
"@typescript-eslint/experimental-utils" "2.27.0"
"@typescript-eslint/typescript-estree" "2.27.0"
eslint-visitor-keys "^1.1.0"

"@typescript-eslint/typescript-estree@2.26.0":
version "2.26.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-2.26.0.tgz#d8132cf1ee8a72234f996519a47d8a9118b57d56"
Expand All @@ -3491,6 +3521,19 @@
semver "^6.3.0"
tsutils "^3.17.1"

"@typescript-eslint/typescript-estree@2.27.0":
version "2.27.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-2.27.0.tgz#a288e54605412da8b81f1660b56c8b2e42966ce8"
integrity sha512-t2miCCJIb/FU8yArjAvxllxbTiyNqaXJag7UOpB5DVoM3+xnjeOngtqlJkLRnMtzaRcJhe3CIR9RmL40omubhg==
dependencies:
debug "^4.1.1"
eslint-visitor-keys "^1.1.0"
glob "^7.1.6"
is-glob "^4.0.1"
lodash "^4.17.15"
semver "^6.3.0"
tsutils "^3.17.1"

"@webassemblyjs/ast@1.8.5":
version "1.8.5"
resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.8.5.tgz#51b1c5fe6576a34953bf4b253df9f0d490d9e359"
Expand Down Expand Up @@ -7599,7 +7642,7 @@ escodegen@^1.11.0, escodegen@^1.9.1:
optionalDependencies:
source-map "~0.6.1"

eslint-config-prettier@^6.9.0:
eslint-config-prettier@^6.10.1, eslint-config-prettier@^6.9.0:
version "6.10.1"
resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-6.10.1.tgz#129ef9ec575d5ddc0e269667bf09defcd898642a"
integrity sha512-svTy6zh1ecQojvpbJSgH3aei/Rt7C6i090l5f2WQ4aB05lYHeZIR1qL4wZyyILTbtmnbHP5Yn8MrsOJMGa8RkQ==
Expand Down Expand Up @@ -14765,6 +14808,11 @@ prettier@^2.0.2:
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.0.2.tgz#1ba8f3eb92231e769b7fcd7cb73ae1b6b74ade08"
integrity sha512-5xJQIPT8BraI7ZnaDwSbu5zLrB6vvi8hVV58yHQ+QK64qrY40dULy0HSRlQ2/2IdzeBpjhDkqdcFBnFeDEMVdg==

prettier@^2.0.4:
version "2.0.4"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.0.4.tgz#2d1bae173e355996ee355ec9830a7a1ee05457ef"
integrity sha512-SVJIQ51spzFDvh4fIbCLvciiDMCrRhlN3mbZvv/+ycjvmF5E73bKdGfU8QDLNmjYJf+lsGnDBC4UUnvTe5OO0w==

pretty-bytes@^5.1.0:
version "5.3.0"
resolved "https://registry.yarnpkg.com/pretty-bytes/-/pretty-bytes-5.3.0.tgz#f2849e27db79fb4d6cfe24764fc4134f165989f2"
Expand Down

0 comments on commit d2ca1ae

Please sign in to comment.