Skip to content

Commit 560fe3a

Browse files
committed
test: refactoring
1 parent c2d448b commit 560fe3a

File tree

7 files changed

+11
-21
lines changed

7 files changed

+11
-21
lines changed

test/projects/reference-bundling/case1/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"packageId": "reference-bundling",
2+
"packageId": "reference-bundling/case1",
33
"apiType": "rest",
44
"version": "v1",
55
"files": [

test/projects/reference-bundling/case2/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"packageId": "reference-bundling",
2+
"packageId": "reference-bundling/case2",
33
"apiType": "rest",
44
"version": "v1",
55
"files": [

test/projects/reference-bundling/case3/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"packageId": "reference-bundling",
2+
"packageId": "reference-bundling/case3",
33
"apiType": "rest",
44
"version": "v1",
55
"files": [

test/projects/reference-bundling/case4/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"packageId": "reference-bundling",
2+
"packageId": "reference-bundling/case4",
33
"apiType": "rest",
44
"version": "v1",
55
"files": [

test/projects/reference-bundling/case5/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"packageId": "reference-bundling",
2+
"packageId": "reference-bundling/case5",
33
"apiType": "rest",
44
"version": "v1",
55
"files": [

test/projects/reference-bundling/case6/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"packageId": "reference-bundling",
2+
"packageId": "reference-bundling/case6",
33
"apiType": "rest",
44
"version": "v1",
55
"files": [

test/reference-bundling.test.ts

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { MESSAGE_SEVERITY, VALIDATION_RULES_SEVERITY_LEVEL_ERROR } from '../src'
44
describe('Reference bundling test', () => {
55
test('external references should be bundled', async () => {
66
const pkg = LocalRegistry.openPackage('reference-bundling/case1')
7-
const result = await pkg.publish(pkg.packageId, { packageId: pkg.packageId })
7+
const result = await pkg.publish(pkg.packageId)
88

99
expect(result.documents.get('openapi.yaml')?.dependencies).toEqual(['reference.yaml'])
1010
})
@@ -14,17 +14,14 @@ describe('Reference bundling test', () => {
1414

1515
await expect(
1616
pkg.publish(pkg.packageId, {
17-
packageId: pkg.packageId,
1817
validationRulesSeverity: { brokenRefs: VALIDATION_RULES_SEVERITY_LEVEL_ERROR },
1918
}),
2019
).rejects.toThrow(/does not exist/)
2120
})
2221

2322
test('should not throw on missing external reference', async () => {
2423
const pkg = LocalRegistry.openPackage('reference-bundling/case2')
25-
const result = await pkg.publish(pkg.packageId, {
26-
packageId: pkg.packageId,
27-
})
24+
const result = await pkg.publish(pkg.packageId)
2825

2926
expect(result.notifications.filter(({ severity }) => severity === MESSAGE_SEVERITY.Error).length).toEqual(2)
3027
expect(result.operations.size).toBe(1)
@@ -33,7 +30,7 @@ describe('Reference bundling test', () => {
3330

3431
test('transitive external references should be bundled', async () => {
3532
const pkg = LocalRegistry.openPackage('reference-bundling/case3')
36-
const result = await pkg.publish(pkg.packageId, { packageId: pkg.packageId })
33+
const result = await pkg.publish(pkg.packageId)
3734

3835
expect(result.documents.get('openapi.yaml')?.dependencies).toEqual([
3936
'reference.yaml',
@@ -46,17 +43,14 @@ describe('Reference bundling test', () => {
4643

4744
await expect(
4845
pkg.publish(pkg.packageId, {
49-
packageId: pkg.packageId,
5046
validationRulesSeverity: { brokenRefs: VALIDATION_RULES_SEVERITY_LEVEL_ERROR },
5147
}),
5248
).rejects.toThrow(/does not exist/)
5349
})
5450

5551
test('should not throw on missing transitive external reference', async () => {
5652
const pkg = LocalRegistry.openPackage('reference-bundling/case4')
57-
const result = await pkg.publish(pkg.packageId, {
58-
packageId: pkg.packageId,
59-
})
53+
const result = await pkg.publish(pkg.packageId)
6054

6155
expect(result.notifications.filter(({ severity }) => severity === MESSAGE_SEVERITY.Error).length).toEqual(2)
6256
expect(result.operations.size).toBe(1)
@@ -68,17 +62,14 @@ describe('Reference bundling test', () => {
6862

6963
await expect(
7064
pkg.publish(pkg.packageId, {
71-
packageId: pkg.packageId,
7265
validationRulesSeverity: { brokenRefs: VALIDATION_RULES_SEVERITY_LEVEL_ERROR },
7366
}),
7467
).rejects.toThrow(/references an invalid location/)
7568
})
7669

7770
test('should not throw on missing internal reference', async () => {
7871
const pkg = LocalRegistry.openPackage('reference-bundling/case5')
79-
const result = await pkg.publish(pkg.packageId, {
80-
packageId: pkg.packageId,
81-
})
72+
const result = await pkg.publish(pkg.packageId)
8273

8374
expect(result.notifications.filter(({ severity }) => severity === MESSAGE_SEVERITY.Error).length).toEqual(1)
8475
expect(result.operations.size).toBe(1)
@@ -88,7 +79,6 @@ describe('Reference bundling test', () => {
8879
const pkg = LocalRegistry.openPackage('reference-bundling/case6')
8980
await expect(
9081
pkg.publish(pkg.packageId, {
91-
packageId: pkg.packageId,
9282
validationRulesSeverity: { brokenRefs: VALIDATION_RULES_SEVERITY_LEVEL_ERROR },
9383
}),
9484
).rejects.toThrow(/not a valid text file/)

0 commit comments

Comments
 (0)