diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..a352bb2 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,17 @@ +name: Node.js CI + +on: [push, pull_request] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: '23' + - run: npm install + - run: npm run test \ No newline at end of file diff --git a/index.test.js b/index.test.js deleted file mode 100644 index fcc8eda..0000000 --- a/index.test.js +++ /dev/null @@ -1,23 +0,0 @@ -import request from 'supertest'; -import app from './index.js'; -import mongoose from 'mongoose'; - -beforeAll(async () => { - await mongoose.connect('mongodb://localhost:27017/my-database', { - useNewUrlParser: true, - useUnifiedTopology: true, - }); -}); - -afterAll(async () => { - await mongoose.connection.close(); -}); -describe('Express App', () => { - it('GET / should return Hello World', async () => { - const res = await request(app).get('/'); - expect(res.statusCode).toBe(200); - expect(res.text).toBe('Hello World!'); - }); -}); - - diff --git a/package.json b/package.json index f70a052..c6c2f12 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "type": "module", "scripts": { "test": "jest --detectOpenHandles", - "start": "node --watch index.js" + "start": "node index.js" }, "author": "Alex", "license": "ISC",