Skip to content

Commit

Permalink
add first tests and add linting to test the github actions tasks setup (
Browse files Browse the repository at this point in the history
#7)

* add first tests and add linting and testing to the github actions tasks
  • Loading branch information
zmjohnso authored Apr 21, 2024
1 parent c6dd8a0 commit 6980364
Show file tree
Hide file tree
Showing 7 changed files with 3,048 additions and 1,313 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,21 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
# Setup Node
- name: Setup (Node.js ${{ matrix.node-version }})
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
# Install
- name: Install
run: npm ci
# Checks
# - name: Lint
# run: npm run lint
- name: Lint
run: npm run lint
# Test
# - name: Test
# run: npm test
- name: Test
run: npm run test
# Build
- name: Build
run: npm run build
72 changes: 46 additions & 26 deletions __mocks__/mock-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
VoiceAuthor,
Photo,
VoiceEntry,
HomePage,
} from "../src/shared/content-types";
import {
NameOrLocationData,
Expand Down Expand Up @@ -43,34 +44,36 @@ const mockPhoto: Photo = {
},
};

export const mockVoiceEntry: Entry<VoiceEntry> = {
sys: {
id: "entryId123",
type: "",
createdAt: "",
updatedAt: "",
locale: "",
contentType: {
sys: undefined as any,
export const mockVoiceEntries: Entry<VoiceEntry>[] = [
{
sys: {
id: "entryId123",
type: "",
createdAt: "",
updatedAt: "",
locale: "",
contentType: {
sys: undefined as any,
},
},
fields: {
title: "Title",
voice: "Voice Data",
photo: [mockPhoto],
photoDate: new Date(),
photoLocation: mockPhotoLocation as unknown as Entry<PhotoLocation>,
entryId: 1,
voiceAuthor: mockVoiceAuthor as unknown as Entry<VoiceAuthor>,
},
metadata: undefined as any,
toPlainObject: function (): object {
throw new Error("Function not implemented.");
},
update: function (): Promise<Entry<VoiceEntry>> {
throw new Error("Function not implemented.");
},
},
fields: {
title: "Title",
voice: "Voice Data",
photo: [mockPhoto],
photoDate: new Date(),
photoLocation: mockPhotoLocation as unknown as Entry<PhotoLocation>,
entryId: 1,
voiceAuthor: mockVoiceAuthor as unknown as Entry<VoiceAuthor>,
},
metadata: undefined as any,
toPlainObject: function (): object {
throw new Error("Function not implemented.");
},
update: function (): Promise<Entry<VoiceEntry>> {
throw new Error("Function not implemented.");
},
};
];

export const mockPhotoLocations: NameOrLocationData[] = [
{ value: "Tokyo", operator: LogicalOperators.And },
Expand All @@ -91,3 +94,20 @@ export const mockPhotoEndDate: DateData = {
value: new Date("2023-12-31"),
operator: DateLogicalOperators.Before,
};

export const mockHomePage: Entry<HomePage> = {
fields: {
logo: mockPhoto,
logoDark: mockPhoto,
welcomeText: "Welcome text",
supportDescription: "Support description",
},
metadata: undefined as any,
sys: undefined as any,
toPlainObject: function (): object {
throw new Error("Function not implemented.");
},
update: function (): Promise<Entry<HomePage>> {
throw new Error("Function not implemented.");
},
};
Loading

0 comments on commit 6980364

Please sign in to comment.