Skip to content

Commit

Permalink
Merge pull request #2 from atlasharry/1-github-actions
Browse files Browse the repository at this point in the history
1 GitHub actions
  • Loading branch information
atlasharry authored Dec 6, 2023
2 parents fc6a5af + bde7a05 commit 7f1e315
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 25 deletions.
26 changes: 1 addition & 25 deletions .github/workflows/npm-publish-github-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,7 @@
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages

name: Node.js Package




on:
release:
types: [created]

on: [push]
jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -20,20 +13,3 @@ jobs:
node-version: 16
- run: npm ci
- run: npm test

publish-gpr:
needs: build
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
registry-url: https://npm.pkg.github.com/
- run: npm ci
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
47 changes: 47 additions & 0 deletions src/render.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import React from "react";
// The React testing library simulates the DOM.
import { render, screen, fireEvent } from "@testing-library/react";
import Login from "./login";
import Register from "./Register";
import Viewsong from "./Viewsong";
import Songdisplay from "./Songdisplay.js";
import Updatesong from "./Updatesong";
import Deletesong from "./Deletesong";
import Createsong from "./Createsong";
import { BrowserRouter } from "react-router-dom";
// The jest-dom lets you analyze the rendered simulation.
import "@testing-library/jest-dom";

// Rendering test for the register page
test("Register Login", () => {
render(
<BrowserRouter>
<Register />
</BrowserRouter>
);

const usernameInput = screen.getByPlaceholderText("Username");
const passwordInput = screen.getByPlaceholderText("Password");
const registerButton = screen.getByRole("button", { name: /Register/i });

expect(usernameInput).toBeInTheDocument();
expect(passwordInput).toBeInTheDocument();
expect(registerButton).toBeInTheDocument();
});

// Rendering test for the register page
test("Register Rendering", () => {
render(
<BrowserRouter>
<Register />
</BrowserRouter>
);

const usernameInput = screen.getByPlaceholderText("Username");
const passwordInput = screen.getByPlaceholderText("Password");
const confirmPasswordInput = screen.getByPlaceholderText("Confirm Password");

expect(usernameInput).toBeInTheDocument();
expect(passwordInput).toBeInTheDocument();
expect(confirmPasswordInput).toBeInTheDocument();
});

0 comments on commit 7f1e315

Please sign in to comment.