-
Notifications
You must be signed in to change notification settings - Fork 121
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(experimental): add some tests for the inventory
Addressed minor output issue Trialed writing tests using mocks on mongoose or using an actual db
- Loading branch information
1 parent
3296303
commit 309b522
Showing
18 changed files
with
7,665 additions
and
4,022 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: CI - experimental - inventory | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
paths: | ||
- experimental/license-inventory/** | ||
pull_request: | ||
branches: [main] | ||
paths: | ||
- experimental/license-inventory/** | ||
|
||
permissions: | ||
pull-requests: write | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
node-version: [18.x] | ||
mongodb-version: [4.4] | ||
|
||
steps: | ||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
|
||
- name: Start MongoDB | ||
uses: supercharge/mongodb-github-action@1.11.0 | ||
with: | ||
mongodb-version: ${{ matrix.mongodb-version }} | ||
|
||
- name: Install dependencies | ||
working-directory: ./experimental/license-inventory | ||
run: npm ci | ||
|
||
- name: Test | ||
working-directory: ./experimental/license-inventory | ||
run: | | ||
MONGO_URI="mongodb://localhost:27017/inventory" npm run test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
node_modules | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,11 @@ | ||
import globals from "globals"; | ||
import pluginJs from "@eslint/js"; | ||
import tseslint from "typescript-eslint"; | ||
|
||
import globals from 'globals'; | ||
import pluginJs from '@eslint/js'; | ||
import tseslint from 'typescript-eslint'; | ||
|
||
/** @type {import('eslint').Linter.Config[]} */ | ||
export default [ | ||
{files: ["**/*.{js,mjs,cjs,ts}"]}, | ||
{languageOptions: { globals: globals.node }}, | ||
{ files: ['**/*.{js,mjs,cjs,ts}'] }, | ||
{ languageOptions: { globals: globals.node } }, | ||
pluginJs.configs.recommended, | ||
...tseslint.configs.recommended, | ||
]; | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { pathsToModuleNameMapper } from 'ts-jest'; | ||
import { compilerOptions } from './tsconfig.json'; | ||
import type { JestConfigWithTsJest } from 'ts-jest'; | ||
|
||
const jestConfig: JestConfigWithTsJest = { | ||
roots: ['<rootDir>/src'], | ||
modulePaths: [compilerOptions.baseUrl], | ||
moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths), | ||
preset: 'ts-jest', | ||
testEnvironment: 'node', | ||
globalSetup: '<rootDir>/src/test/globalSetup.ts', | ||
globalTeardown: '<rootDir>/src/test/globalTeardown.ts', | ||
setupFilesAfterEnv: ['<rootDir>/src/test/setupFile.ts'], | ||
}; | ||
|
||
export default jestConfig; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.