Skip to content

Commit

Permalink
fix: build and test mobile API (#1217)
Browse files Browse the repository at this point in the history
* fix: build and test mobile API

* chore: remove env file print command

Co-authored-by: Sem Bauke <[email protected]>

---------

Co-authored-by: Sem Bauke <[email protected]>
  • Loading branch information
Nirajn2311 and Sembauke authored Apr 9, 2024
1 parent 554f2fc commit 76f4195
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 35 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Node.js CI
name: Build and Test API

on:
push:
Expand All @@ -11,9 +11,9 @@ defaults:
working-directory: mobile-api

jobs:
lint-and-test:
name: Lint and Test
runs-on: ubuntu-22.04
build-and-test:
name: Build and Test API
runs-on: ubuntu-latest

strategy:
matrix:
Expand All @@ -35,5 +35,17 @@ jobs:
- name: Lint source files
run: npm run lint

- name: Run test
- name: Build and start container
run: docker compose -f docker-compose.dev.yml up -d

- name: Sleep for 1 minute
run: sleep 60

- name: Ping container
run: curl localhost:3000/ping

- name: Create .env file
run: cp sample.env .env

- name: Run tests
run: npm test
27 changes: 0 additions & 27 deletions .github/workflows/test-image.yml

This file was deleted.

4 changes: 2 additions & 2 deletions mobile-api/sample.env
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
MONGODB_URL="mongodb://localhost:27017/mobile-api"
DEV_URL="https://api.mobile.freecodecamp.dev"
MONGODB_URL=mongodb://localhost:27017/mobile-api
DEV_URL=http://localhost:3000
3 changes: 2 additions & 1 deletion mobile-api/src/__tests__/podcast.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'dotenv/config';
import fetch from 'node-fetch';
import { Podcast } from '../models/Podcast';
import { Episode } from '../models/Episode';

interface pingEndpoint {
msg: string;
}
Expand All @@ -12,7 +13,7 @@ interface episodeEndpoint {
}

describe('podcast api', () => {
const url = process.env.DEV_URL ?? 'https://api.mobile.freecodecamp.dev';
const url = process.env.DEV_URL;

let localPodcastId = '';
let localEpisodeId = '';
Expand Down

0 comments on commit 76f4195

Please sign in to comment.