Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Commit

Permalink
Merge pull request #18 from w3bdesign/develop
Browse files Browse the repository at this point in the history
Begynnelse prosjekt
  • Loading branch information
w3bdesign authored Dec 29, 2021
2 parents 02028e2 + 6e870ef commit 8e50834
Show file tree
Hide file tree
Showing 27 changed files with 3,271 additions and 838 deletions.
7 changes: 4 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: 2
version: 2.1
jobs:
build:
working_directory: ~/stein-saks-papir
working_directory: ~/dfweb
docker:
- image: circleci/node:latest
steps:
Expand All @@ -16,8 +16,9 @@ jobs:
paths:
- /home/circleci/.npm
- run:
name: Run Tests
name: Run Jest Tests
command: npm test
- run:
name: Codecov
command: bash <(curl -s https://codecov.io/bash)
parallelism: 6
7 changes: 4 additions & 3 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"extends": "next/core-web-vitals", "cypress",

"globals": {
"extends": ["next/core-web-vitals", "plugin:cypress/recommended"],
"plugins": ["react", "cypress"],
"globals": {
"cy": true
}
}
25 changes: 17 additions & 8 deletions __tests__/index.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,25 @@
* @jest-environment jsdom
*/

import React from 'react';
import { render, screen } from '@testing-library/react';
import Home from '../pages/index';
import React from "react";
import { render, screen } from "@testing-library/react";
import Home from "../pages/index";

describe('Home', () => {
it('renders a heading', () => {
describe("Home", () => {
it("Welcome to next eksisterer ikke", () => {
render(<Home />);
const heading = screen.getByRole('heading', {
name: /welcome to next\.js!/i,
const welcometoNext = screen.queryByText("heading", {
name: /welcome to next/i,
});
expect(heading).toBeInTheDocument();
console.log(welcometoNext);
expect(welcometoNext).not.toBeInTheDocument();
});

it("Velkommen til Index eksisterer", () => {
render(<Home />);
const velkommen = screen.getByRole("heading", {
name: /velkommen til Index/i,
});
expect(velkommen).toBeInTheDocument();
});
});
3 changes: 3 additions & 0 deletions cypress.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"baseUrl": "http://localhost:3000"
}
5 changes: 5 additions & 0 deletions cypress/fixtures/example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "Using fixtures to represent data",
"email": "hello@cypress.io",
"body": "Fixtures are a great way to mock data for responses to routes"
}
12 changes: 12 additions & 0 deletions cypress/integration/index.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/// <reference types="cypress"/>

describe(`The Home Page`, () => {
beforeEach(() => {
cy.visit("/");
});
it(`Contains my name in the hero section`, () => {
cy.get("h1").contains("Velkommen");
});
});

export {};
22 changes: 22 additions & 0 deletions cypress/plugins/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/// <reference types="cypress" />
// ***********************************************************
// This example plugins/index.js can be used to load plugins
//
// You can change the location of this file or turn off loading
// the plugins file with the 'pluginsFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/plugins-guide
// ***********************************************************

// This function is called when a project is opened or re-opened (e.g. due to
// the project's config changing)

/**
* @type {Cypress.PluginConfig}
*/
// eslint-disable-next-line no-unused-vars
module.exports = (on, config) => {
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config
}
25 changes: 25 additions & 0 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// ***********************************************
// This example commands.js shows you how to
// create various custom commands and overwrite
// existing commands.
//
// For more comprehensive examples of custom
// commands please read more here:
// https://on.cypress.io/custom-commands
// ***********************************************
//
//
// -- This is a parent command --
// Cypress.Commands.add('login', (email, password) => { ... })
//
//
// -- This is a child command --
// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
//
//
// -- This is a dual command --
// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
//
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
20 changes: 20 additions & 0 deletions cypress/support/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// ***********************************************************
// This example support/index.js is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************

// Import commands.js using ES2015 syntax:
import './commands'

// Alternatively you can use CommonJS syntax:
// require('./commands')
7 changes: 4 additions & 3 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
// jest.config.js
const nextJest = require('next/jest');
const nextJest = require("next/jest");

const createJestConfig = nextJest({
// Provide the path to your Next.js app to load next.config.js and .env files in your test environment
dir: './',
dir: "./",
});

// Add any custom config to be passed to Jest
const customJestConfig = {
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
setupFilesAfterEnv: ["<rootDir>/jest.setup.js"],
testPathIgnorePatterns: ["<rootDir>/cypress/"],
};

// createJestConfig is exported this way to ensure that next/jest can load the Next.js config which is async
Expand Down
1 change: 1 addition & 0 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/** @type {import('next').NextConfig} */
module.exports = {
reactStrictMode: true,
// swcMinify: false // Skru av denne?
}
Loading

1 comment on commit 8e50834

@vercel
Copy link

@vercel vercel bot commented on 8e50834 Dec 29, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.