diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..554cf11 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,20 @@ +image: node:latest + +stages: + - test + - build + +cache: + paths: + - node_modules/ + +test: + stage: test + script: + - npm install + - npm run test + +build: + stage: build + script: + - npm run build diff --git a/src/elements/Tag.js b/src/elements/Tag.js index 015abe8..66a1476 100644 --- a/src/elements/Tag.js +++ b/src/elements/Tag.js @@ -13,7 +13,7 @@ class Tag extends React.Component { render() { // todo onclick events correctlyy return ( - + ); } } diff --git a/src/elements/Tag.test.js b/src/elements/Tag.test.js new file mode 100644 index 0000000..7995f4e --- /dev/null +++ b/src/elements/Tag.test.js @@ -0,0 +1,16 @@ +import React from "react"; +import ReactDom from 'react-dom' +import Tag from './Tag' +import {render} from '@testing-library/react' +import "@testing-library/jest-dom" + +it('renders without crashing ', function () { + const div = document.createElement("div"); + ReactDom.render(,div); + ReactDom.unmountComponentAtNode(div); +}); + +it('renders childs correctly', function () { + const {getByTestId} = render(test); + expect(getByTestId("Test-Tag")).toHaveTextContent("test"); +});