forked from github/maintainermonth
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
👷 ✅ Add tests and config CI to run that
- Loading branch information
Showing
8 changed files
with
3,249 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: build-and-deploy | ||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout 🛎️ | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install, Test, and Build 🔧 | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '14' | ||
|
||
- name: Install, Test, and Build 🔧 | ||
run: | | ||
npm install | ||
npm run test | ||
npm run build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// jest.config.js | ||
const nextJest = require('next/jest') | ||
|
||
const createJestConfig = nextJest({ dir: './' }) | ||
|
||
const customJestConfig = { | ||
moduleDirectories: ['node_modules', '<rootDir>/'], | ||
testEnvironment: 'jest-environment-jsdom', | ||
} | ||
|
||
module.exports = createJestConfig(customJestConfig) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import fs from 'fs' | ||
|
||
import { getEventBySlug, parseEvent } from '../api/events' | ||
|
||
describe('Event files', () => { | ||
test('All event files have ".md" extension', () => { | ||
const eventFiles = fs.readdirSync('content/events') | ||
|
||
const areAllValid = eventFiles.every((fileName) => fileName.endsWith('.md')) | ||
|
||
expect(areAllValid).toBe(true) | ||
}) | ||
|
||
test('All events have correct dates (or TBD)', () => { | ||
const eventFiles = fs.readdirSync('content/events') | ||
|
||
const events = eventFiles.map((fileName) => { | ||
const slug = fileName.replace('.md', '') | ||
const event = getEventBySlug(slug) | ||
return event | ||
}) | ||
|
||
events.forEach((event) => { | ||
expect(() => parseEvent(event)).not.toThrowError() | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import resourcesJSON from '../content/library/resources.json' | ||
|
||
const { resources } = resourcesJSON | ||
|
||
describe('Resources', () => { | ||
test('Resources must have a title', () => { | ||
const areAllValid = resources.every((resource) => resource.title) | ||
expect(areAllValid).toBe(true) | ||
}) | ||
|
||
test('Resources must have an author', () => { | ||
const areAllValid = resources.every((resource) => resource.author) | ||
expect(areAllValid).toBe(true) | ||
}) | ||
|
||
test('Resources must have a link', () => { | ||
const areAllValid = resources.every((resource) => resource.link) | ||
expect(areAllValid).toBe(true) | ||
}) | ||
|
||
test('Resources must have a type', () => { | ||
const areAllValid = resources.every((resource) => resource.type) | ||
expect(areAllValid).toBe(true) | ||
}) | ||
|
||
test('Resources must have topics', () => { | ||
const areAllValid = resources.every((resource) => resource.topics) | ||
expect(areAllValid).toBe(true) | ||
}) | ||
}) |
Oops, something went wrong.