diff --git a/.env b/.env deleted file mode 100644 index e28eaef..0000000 --- a/.env +++ /dev/null @@ -1,2 +0,0 @@ -TMDB_API_KEY="ea021b3b0775c8531592713ab727f254" -PORT=3000 \ No newline at end of file diff --git a/.env_example b/.env_example new file mode 100644 index 0000000..c0c52bb --- /dev/null +++ b/.env_example @@ -0,0 +1,2 @@ +TMDB_API_KEY="YOUR_TMDB_API_KEY_HERE" +PORT=3000 \ No newline at end of file diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index d587813..0000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -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" diff --git a/babel.config.js b/babel.config.js deleted file mode 100644 index 91c87ee..0000000 --- a/babel.config.js +++ /dev/null @@ -1,5 +0,0 @@ -export default { - presets: [ - ['@babel/preset-env', { targets: { node: 'current' } }] - ] -} \ No newline at end of file diff --git a/jest.config.js b/jest.config.js deleted file mode 100644 index 04f5398..0000000 --- a/jest.config.js +++ /dev/null @@ -1,8 +0,0 @@ -export default { - testEnvironment: 'node', - transform: {}, - transformIgnorePatterns: [], - moduleNameMapper: { - '^(\\.{1,2}/.*)\\.js$': '$1' - } - } \ No newline at end of file diff --git a/package.json b/package.json index 4b1403a..d83b096 100644 --- a/package.json +++ b/package.json @@ -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" } -} \ No newline at end of file +} diff --git a/tests/app.test.js b/tests/app.test.js deleted file mode 100644 index 416d009..0000000 --- a/tests/app.test.js +++ /dev/null @@ -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)); - }); -}); \ No newline at end of file