Skip to content

Commit

Permalink
chore: add unit test automation
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 592614153
  • Loading branch information
sararob authored and copybara-github committed Dec 21, 2023
1 parent de477ce commit 8240391
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 20 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/presubmit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
on:
pull_request:
name: presubmit
jobs:
units:
runs-on: ubuntu-latest
strategy:
matrix:
node: [18, 20]
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
with:
version: ^6.24.1
- run: node --version
- run: npm run test
name: Run unit tests
env:
BUILD_TYPE: presubmit
TEST_TYPE: units
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"docs-test": "linkinator docs",
"compile:oss": "tsc -p tsconfig.json.oss",
"fix": "gts fix",
"test": "TODO",
"test": "jasmine build/test",
"system-test": "jasmine build/system_test/*.js",
"lint": "gts lint",
"clean-js-files": "find . -type f -name \"*.js\" -exec rm -f {} +",
Expand All @@ -36,9 +36,9 @@
},
"devDependencies": {
"@types/jasmine": "^5.1.2",
"jasmine": "^5.1.0",
"@types/node": "^20.9.0",
"gts": "^5.2.0",
"jasmine": "^5.1.0",
"typescript": "~5.2.0",
"jsdoc": "^4.0.0",
"jsdoc-fresh": "^3.0.0",
Expand Down
20 changes: 4 additions & 16 deletions src/index_test.ts → test/index_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,10 @@
/* tslint:disable */
import 'jasmine';

import {ChatSession, GenerativeModel, StartChatParams, VertexAI} from './index';
import * as StreamFunctions from './process_stream';
import {
CountTokensRequest,
FinishReason,
GenerateContentRequest,
GenerateContentResponse,
GenerateContentResult,
HarmBlockThreshold,
HarmCategory,
HarmProbability,
SafetyRating,
SafetySetting,
StreamGenerateContentResult,
} from './types/content';
import {constants} from './util';
import {ChatSession, GenerativeModel, StartChatParams, VertexAI} from '../src/index';
import * as StreamFunctions from '../src/process_stream';
import {CountTokensRequest, FinishReason, GenerateContentRequest, GenerateContentResponse, GenerateContentResult, HarmBlockThreshold, HarmCategory, HarmProbability, SafetyRating, SafetySetting, StreamGenerateContentResult,} from '../src/types/content';
import {constants} from '../src/util';

const PROJECT = 'test_project';
const LOCATION = 'test_location';
Expand Down
5 changes: 3 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@
},
"include": [
"src/*.ts",
"src/*.d.ts",
"src/**/*.ts",
"test/*.ts",
"test/**/*.ts",
"src/**/*.js",
"src/**/*.json",
"system_test/*.ts"
]
}

0 comments on commit 8240391

Please sign in to comment.