diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index de4d255..3996a10 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -38,6 +38,12 @@ jobs: node-version: 16 registry-url: https://registry.npmjs.org/ - run: npm ci --legacy-peer-deps + - run: npm run build + env: + LIBRARY_NAME: "@aleleba/ro-ut-ui" + EXTERNAL_CSS: "true" - run: npm publish --access=public env: + LIBRARY_NAME: "@aleleba/ro-ut-ui" + EXTERNAL_CSS: "true" NODE_AUTH_TOKEN: ${{secrets.npm_token}} \ No newline at end of file diff --git a/.github/workflows/npm-test.yml b/.github/workflows/npm-test.yml index 167426c..c621841 100644 --- a/.github/workflows/npm-test.yml +++ b/.github/workflows/npm-test.yml @@ -44,4 +44,7 @@ jobs: node-version: 16 registry-url: https://registry.npmjs.org/ - run: npm ci --legacy-peer-deps - - run: npm run build \ No newline at end of file + - run: npm run build + env: + LIBRARY_NAME: "@aleleba/ro-ut-ui" + EXTERNAL_CSS: "true" \ No newline at end of file diff --git a/package.json b/package.json index e368085..617e3c0 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "react-list-ui-library", "version": "1.0.0", - "description": "A starter kit for create a React component Library with storybook", + "description": "A Library with storybook for a list app", "main": "dist/index.js", "scripts": { "start": "npm run storybook", @@ -18,7 +18,7 @@ }, "repository": { "type": "git", - "url": "git+https://github.com/aleleba/create-react-component-library.git" + "url": "git+https://github.com/aleleba/react-list-ui-library.git" }, "keywords": [ "create", diff --git a/src/components/Input/__tests__/Input.test.cy.tsx b/src/components/Input/__tests__/Input.test.cy.tsx new file mode 100644 index 0000000..5f77e3f --- /dev/null +++ b/src/components/Input/__tests__/Input.test.cy.tsx @@ -0,0 +1,11 @@ +import React from 'react'; +import { Input } from '@components'; + +describe('Testing Input Component', () => { + beforeEach(() => { + cy.mount(); + }); + it('Show right text on placeholder', () => { + cy.get('input').should('have.attr', 'placeholder', 'Test Placeholder'); + }); +}) diff --git a/src/components/Input/__tests__/Input.test.tsx b/src/components/Input/__tests__/Input.test.tsx new file mode 100644 index 0000000..a1d8da3 --- /dev/null +++ b/src/components/Input/__tests__/Input.test.tsx @@ -0,0 +1,18 @@ +import React from 'react'; +import { render, screen } from '@testing-library/react'; +import { Input } from '@components'; + +describe('Testing Input Component', () => { + beforeEach(() => { + // fetchMock.resetMocks(); + render() + }); + it('Show right text on placeholder', async () => { + /* fetchMock.mockResponseOnce(JSON.stringify({ + //First Data Fetch + data: 'data' + })); */ + const input = screen.getByPlaceholderText('Test Placeholder'); + expect(input).toBeInTheDocument(); + }) +}) diff --git a/src/components/List/__tests__/List.test.cy.tsx b/src/components/List/__tests__/List.test.cy.tsx new file mode 100644 index 0000000..d9bd54e --- /dev/null +++ b/src/components/List/__tests__/List.test.cy.tsx @@ -0,0 +1,24 @@ +import React from 'react'; +import { List, Status } from '@components'; + +describe('Testing List Component', () => { + beforeEach(() => { + cy.mount(); + }) + it('Show All Items in a list', () => { + cy.get('input').should('have.length', 3); + }) +}) diff --git a/src/components/List/__tests__/List.test.tsx b/src/components/List/__tests__/List.test.tsx new file mode 100644 index 0000000..6da62e6 --- /dev/null +++ b/src/components/List/__tests__/List.test.tsx @@ -0,0 +1,31 @@ +import React from 'react'; +import { render, screen } from '@testing-library/react'; +import { List, Status } from '@components'; + +describe('Testing List Component', () => { + beforeEach(() => { + // fetchMock.resetMocks(); + render() + }); + it('Show All Items in a list', async () => { + /* fetchMock.mockResponseOnce(JSON.stringify({ + //First Data Fetch + data: 'data' + })); */ + const items = screen.getAllByRole('checkbox'); + expect(items).toHaveLength(3); + }) +})