openai-api-mock 0.1.22 → 0.1.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,30 @@
1
+ name: Tests
2
+
3
+ on:
4
+ push:
5
+ branches: [ dev ]
6
+ pull_request:
7
+ branches: [ dev ]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+
13
+ strategy:
14
+ matrix:
15
+ node-version: [16.x, 18.x, 20.x]
16
+
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+
20
+ - name: Use Node.js ${{ matrix.node-version }}
21
+ uses: actions/setup-node@v4
22
+ with:
23
+ node-version: ${{ matrix.node-version }}
24
+ cache: 'npm'
25
+
26
+ - name: Install dependencies
27
+ run: npm ci
28
+
29
+ - name: Run tests
30
+ run: npm test
package/jest.config.js ADDED
@@ -0,0 +1,15 @@
1
+ export default {
2
+ collectCoverageFrom: [
3
+ 'main.js',
4
+ '!**/node_modules/**',
5
+ ],
6
+ coverageReporters: ['text', 'lcov'],
7
+ coverageThreshold: {
8
+ global: {
9
+ branches: 80,
10
+ functions: 80,
11
+ lines: 80,
12
+ statements: 80
13
+ }
14
+ }
15
+ };
package/main.test.js CHANGED
@@ -1,3 +1,4 @@
1
+ import fetch from 'node-fetch';
1
2
  import { mockOpenAIResponse, stopMocking } from './main.js'
2
3
  import OpenAI from 'openai';
3
4
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openai-api-mock",
3
- "version": "0.1.22",
3
+ "version": "0.1.23",
4
4
  "description": "A Node.js module for mocking OpenAI API responses in a development environment",
5
5
  "repository": {
6
6
  "type": "git",
@@ -14,10 +14,17 @@
14
14
  "development",
15
15
  "testing",
16
16
  "chatgpt",
17
- "interceptor"
17
+ "interceptor",
18
+ "sandbox",
19
+ "fake",
20
+ "mocking",
21
+ "ai",
22
+ "artificial intelligence",
23
+ "machine learning"
18
24
  ],
19
25
  "scripts": {
20
- "test":"node --experimental-vm-modules node_modules/jest/bin/jest.js"
26
+ "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
27
+ "coverage": "node --experimental-vm-modules node_modules/jest/bin/jest.js --coverage"
21
28
  },
22
29
  "author": "Chiheb Nabil",
23
30
  "license": "MIT",
@@ -28,6 +35,10 @@
28
35
  },
29
36
  "devDependencies": {
30
37
  "jest": "^29.7.0",
38
+ "node-fetch": "^3.3.2",
31
39
  "openai": "^4.52.4"
40
+ },
41
+ "engines": {
42
+ "node": ">=16.0.0"
32
43
  }
33
44
  }
package/readme.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # OpenAI API Mock
2
2
 
3
- This is a Node.js module for mocking OpenAI API responses in a development environment.
3
+ This is a Node.js module for mocking OpenAI API responses in a development environment.
4
+
5
+ [![Tests](https://github.com/chihebnabil/openai-api-mock/actions/workflows/test.yml/badge.svg)](https://github.com/chihebnabil/openai-api-mock/actions/workflows/test.yml)
4
6
 
5
7
  It's useful for testing and development purposes when you don't want to make actual API calls.
6
8