Skip to content

Commit

Permalink
Merge branch 'testing-100-meal-planner-starter' into testing-101-meal…
Browse files Browse the repository at this point in the history
…-planner
  • Loading branch information
yjaaidi committed Nov 3, 2023
2 parents 072e654 + 3e1f677 commit f1f1d2d
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 10 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: ✅ Test
on:
push:

env:
# Using Nx Cloud is safer
NX_REJECT_UNKNOWN_LOCAL_CACHE: 0

jobs:
test:
name: ✅ Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- uses: nrwl/nx-set-shas@v3
with:
main-branch-name: ${{ github.ref_name }}

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 20

- name: Cache Nx
uses: actions/cache@v3
with:
path: .nx/cache
key: ${{ runner.os }}-nx-${{ github.sha }}
restore-keys: ${{ runner.os }}-nx

- uses: pnpm/action-setup@v2
with:
version: 8

- run: pnpm install

- run: pnpm nx run-many --parallel=4 -t build,lint,test

# Skip Cypress Component tests on branches that don't have them
# this avoids no specs error and polluting the code base
# with some cypress test file from the beginning.
- id: has-cypress-tests
run: |
if [ $(find apps libs -name '*.cy.ts' | wc -l) -gt 0 ]; then
echo "::set-output name=has-cypress-tests::true"
else
echo "::set-output name=has-cypress-tests::false"
fi
- name: Cypress component tests
if: steps.has-cypress-tests.outputs.has-cypress-tests == 'true'
run: pnpm nx run-many --parallel=4 -t component-test
11 changes: 4 additions & 7 deletions apps/whiskmate/src/app/app.config.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import { ApplicationConfig } from '@angular/core';
import { enableProdMode, importProvidersFrom } from '@angular/core';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { HttpClientModule } from '@angular/common/http';
import { provideAnimations } from '@angular/platform-browser/animations';
import { provideHttpClient } from '@angular/common/http';

export const appConfig: ApplicationConfig = {
providers: [
importProvidersFrom(BrowserAnimationsModule),
importProvidersFrom(HttpClientModule),
],
providers: [provideAnimations(), provideHttpClient()],
};
2 changes: 1 addition & 1 deletion apps/whiskmate/src/app/shared/card.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
imports: [NgIf],
template: ` <img *ngIf="pictureUri" class="picture" [src]="pictureUri" />
<div class="content">
<ng-content></ng-content>
<ng-content/>
</div>`,
styles: [
`
Expand Down
2 changes: 1 addition & 1 deletion apps/whiskmate/src/app/shared/catalog.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ChangeDetectionStrategy, Component } from '@angular/core';
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: true,
selector: 'wm-catalog',
template: `<ng-content></ng-content>`,
template: `<ng-content/>`,
styles: [
`
:host {
Expand Down
2 changes: 1 addition & 1 deletion apps/whiskmate/src/app/shared/title.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ChangeDetectionStrategy, Component } from '@angular/core';
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: true,
selector: 'wm-title',
template: `<h1><ng-content></ng-content></h1>`,
template: `<h1><ng-content/></h1>`,
styles: [
`
:host {
Expand Down
1 change: 1 addition & 0 deletions apps/whiskmate/src/test-setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import '@testing-library/jest-dom';

// eslint-disable-next-line @typescript-eslint/no-empty-function
const noop = () => {};
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const Zone = (globalThis as any)['Zone'] as any;
Zone['ProxyZoneSpec'] = {
assertPresent: () => ({ onHasTask: noop, resetDelegate: noop }),
Expand Down

0 comments on commit f1f1d2d

Please sign in to comment.