mirror of
https://github.com/Inside4ndroid/TMDB-Embed-API.git
synced 2026-10-22 09:35:11 +00:00
Rolled Back to remove workflow until i can fix it.
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
TMDB_API_KEY="YOUR_TMDB_API_KEY_HERE"
|
||||
PORT=3000
|
||||
@@ -1,34 +0,0 @@
|
||||
name: Node.js CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main ]
|
||||
pull_request:
|
||||
branches: [ main ]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [23.x]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
cache: 'npm'
|
||||
|
||||
- run: npm ci
|
||||
|
||||
- name: Run Tests
|
||||
run: npm run test:ci
|
||||
|
||||
# Optional: Show test output log (if you use one)
|
||||
- name: Show test log
|
||||
if: always()
|
||||
run: |
|
||||
cat jest.log || echo "No jest.log found"
|
||||
@@ -1,5 +0,0 @@
|
||||
export default {
|
||||
presets: [
|
||||
['@babel/preset-env', { targets: { node: 'current' } }]
|
||||
]
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
export default {
|
||||
testEnvironment: 'node',
|
||||
transform: {},
|
||||
transformIgnorePatterns: [],
|
||||
moduleNameMapper: {
|
||||
'^(\\.{1,2}/.*)\\.js$': '$1'
|
||||
}
|
||||
}
|
||||
+3
-16
@@ -7,27 +7,14 @@
|
||||
"type": "module",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test:ci": "cross-env NODE_OPTIONS=--experimental-vm-modules jest --detectOpenHandles --forceExit --ci --testTimeout=30000 --reporters=default --reporters=jest-junit",
|
||||
"test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest --detectOpenHandles",
|
||||
"test:watch": "cross-env NODE_OPTIONS=--experimental-vm-modules jest --watch",
|
||||
"test:debug": "cross-env NODE_OPTIONS='--experimental-vm-modules --inspect-brk' jest --runInBand",
|
||||
"dev": "node --watch index.js",
|
||||
"start": "node index.js"
|
||||
"start": "node --watch index.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"cheerio": "^1.0.0",
|
||||
"cors": "^2.8.5",
|
||||
"dotenv": "^16.4.7",
|
||||
"express": "^4.18.2",
|
||||
"fetch": "^1.1.0",
|
||||
"node-fetch": "^3.3.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.26.10",
|
||||
"@babel/preset-env": "^7.26.9",
|
||||
"cross-env": "^7.0.3",
|
||||
"jest-junit": "^15.0.0",
|
||||
"jest": "^29.7.0",
|
||||
"supertest": "^7.1.0",
|
||||
"jest-extended": "^3.2.4"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,74 +0,0 @@
|
||||
import request from 'supertest';
|
||||
import { server } from '../index.js';
|
||||
import app from '../index.js';
|
||||
|
||||
const movieProviders = ['2embed', 'vidsrcsu'];
|
||||
|
||||
describe('API Routes', () => {
|
||||
describe('GET /', () => {
|
||||
it('should return welcome message', async () => {
|
||||
const res = await request(app).get('/');
|
||||
expect(res.statusCode).toEqual(200);
|
||||
expect(res.body).toHaveProperty('INTRO');
|
||||
});
|
||||
});
|
||||
|
||||
describe('Movie Routes', () => {
|
||||
movieProviders.forEach(provider => {
|
||||
it(`should work with ${provider} provider`, async () => {
|
||||
const testId = 533535;
|
||||
const res = await request(app).get(`/movie/${provider}/${testId}`);
|
||||
expect([200, 404]).toContain(res.statusCode);
|
||||
if (res.statusCode === 200) {
|
||||
res.body.forEach(sourceItem => {
|
||||
expect(sourceItem).toHaveProperty('source');
|
||||
expect(sourceItem.source).toHaveProperty('files');
|
||||
expect(sourceItem.source.files).toBeInstanceOf(Array);
|
||||
expect(sourceItem.source.files.length).toBeGreaterThan(0);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('TV Show Routes', () => {
|
||||
movieProviders.forEach(provider => {
|
||||
it(`should work with ${provider} provider`, async () => {
|
||||
const testId = 93405;
|
||||
const res = await request(app)
|
||||
.get(`/tv/${provider}/${testId}`)
|
||||
.query({ s: 1, e: 1 });
|
||||
expect([200, 404]).toContain(res.statusCode);
|
||||
if (res.statusCode === 200) {
|
||||
res.body.forEach(sourceItem => {
|
||||
expect(sourceItem).toHaveProperty('source');
|
||||
expect(sourceItem.source).toHaveProperty('files');
|
||||
expect(sourceItem.source.files).toBeInstanceOf(Array);
|
||||
expect(sourceItem.source.files.length).toBeGreaterThan(0);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('Error Handling', () => {
|
||||
it('GET /nonexistent - should return 404', async () => {
|
||||
const res = await request(app).get('/nonexistent');
|
||||
expect(res.statusCode).toEqual(404);
|
||||
});
|
||||
|
||||
it('GET /movie/ - should return 405', async () => {
|
||||
const res = await request(app).get('/movie/');
|
||||
expect(res.statusCode).toEqual(405);
|
||||
});
|
||||
|
||||
it('GET /tv/ - should return 405', async () => {
|
||||
const res = await request(app).get('/tv/');
|
||||
expect(res.statusCode).toEqual(405);
|
||||
});
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await new Promise(resolve => server.close(resolve));
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user