Skip to content

Commit bd9a1d5

Browse files
committed
add step to check remaining data after tests , testing purposes only
1 parent 09d1482 commit bd9a1d5

File tree

8 files changed

+75
-4
lines changed

8 files changed

+75
-4
lines changed

.github/workflows/deploy_pr.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,20 @@ jobs:
4545
- name: Run functional tests
4646
run: npm run test:functional
4747

48+
check-remaining-data-after-tests:
49+
runs-on: ubuntu-latest
50+
steps:
51+
- uses: actions/checkout@v3
52+
- uses: actions/setup-node@v3
53+
with:
54+
node-version: 19
55+
56+
- name: Install npm dependencies
57+
run: npm ci
58+
59+
- name: Check remaining data after tests
60+
run: npm run test:check-remaining-data
61+
4862
publish-gpr:
4963
needs: [test-unit, test-integration, test-functional]
5064
runs-on: ubuntu-latest
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import config from './jest.config'
2+
3+
config.modulePathIgnorePatterns = [
4+
'<rootDir>/test/unit',
5+
'<rootDir>/test/functional',
6+
'<rootDir>/test/integration'
7+
]
8+
console.log('RUNNING TESTS TO GET FILE COUNTS')
9+
10+
export default config

jest.config.functional.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import config from './jest.config'
22

3-
config.modulePathIgnorePatterns = ['<rootDir>/test/unit', '<rootDir>/test/integration']
3+
config.modulePathIgnorePatterns = [
4+
'<rootDir>/test/unit',
5+
'<rootDir>/test/integration',
6+
'<rootDir>/test/check-remaining-data'
7+
]
48
console.log('RUNNING FUNCTIONAL TESTS')
59

610
export default config

jest.config.integration.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import config from './jest.config'
22

3-
config.modulePathIgnorePatterns = ['<rootDir>/test/unit', '<rootDir>/test/functional']
3+
config.modulePathIgnorePatterns = [
4+
'<rootDir>/test/unit',
5+
'<rootDir>/test/functional',
6+
'<rootDir>/test/check-remaining-data'
7+
]
48
console.log('RUNNING INTEGRATION TESTS')
59

610
export default config

jest.config.unit.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import config from './jest.config'
22

3-
config.modulePathIgnorePatterns = ['<rootDir>/test/integration', '<rootDir>/test/functional']
3+
config.modulePathIgnorePatterns = [
4+
'<rootDir>/test/integration',
5+
'<rootDir>/test/functional',
6+
'<rootDir>/test/check-remaining-data'
7+
]
48
delete config.globalSetup
59
delete config.testTimeout
610
console.log('RUNNING UNIT TESTS')

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"test:unit": "jest -c jest.config.unit.ts",
1414
"test:integration": "jest -c jest.config.integration.ts",
1515
"test:functional": "jest -c jest.config.functional.ts",
16+
"test:check-remaining-data": "jest -c jest.config.check-remaining-data.ts",
1617
"test:coverage": "jest --coverage -c jest.config.ts",
1718
"test:coverage:check": "jest --coverage --ci --config jest.config.ts",
1819
"lint": "npm run lint:eslint && npm run lint:prettier",
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { ApiConfig } from '../../src'
2+
import { CollectionsRepository } from '../../src/collections/infra/repositories/CollectionsRepository'
3+
import { DataverseApiAuthMechanism } from '../../src/core/infra/repositories/ApiConfig'
4+
import { ROOT_COLLECTION_ALIAS } from '../testHelpers/collections/collectionHelper'
5+
import { TestConstants } from '../testHelpers/TestConstants'
6+
7+
describe('Checks remaining data', () => {
8+
const sut: CollectionsRepository = new CollectionsRepository()
9+
10+
beforeAll(async () => {
11+
ApiConfig.init(
12+
TestConstants.TEST_API_URL,
13+
DataverseApiAuthMechanism.API_KEY,
14+
process.env.TEST_API_KEY
15+
)
16+
})
17+
18+
it('root collection info', async () => {
19+
const collection = await sut.getCollection(ROOT_COLLECTION_ALIAS)
20+
21+
console.log(JSON.stringify(collection, null, 2))
22+
23+
expect(1).toBe(1)
24+
})
25+
26+
it('root collection items', async () => {
27+
const items = await sut.getCollectionItems(ROOT_COLLECTION_ALIAS)
28+
29+
console.log(JSON.stringify(items, null, 2))
30+
31+
expect(1).toBe(1)
32+
})
33+
})

tsconfig.tests.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
"jest.config.integration.ts",
1010
"jest.config.ts",
1111
"jest.config.unit.ts",
12-
"jest.config.functional.ts"
12+
"jest.config.functional.ts",
13+
"jest.config.check-remaining-data.ts"
1314
],
1415
"exclude": ["node_modules", "dist"]
1516
}

0 commit comments

Comments
 (0)