Components what-changed completed.

Now to move on to the document and finally some perform stress testing.

AND THEN! we're done with this MF. Jesus H Christ, what a mission.
This commit is contained in:
Dave Shanley
2022-11-15 13:21:19 -05:00
parent f66c77ccb5
commit 12594fdf1c
6 changed files with 909 additions and 36 deletions

View File

@@ -199,17 +199,21 @@ func TestCompareSchemas_RefIgnore(t *testing.T) {
func TestCompareSchemas_RefChanged(t *testing.T) {
left := `components:
schemas:
Yo:
Woah:
type: int
Yo:
type: string
OK:
$ref: '#/components/schemas/No'`
$ref: '#/components/schemas/Woah'`
right := `components:
schemas:
Yo:
Woah:
type: int
Yo:
type: string
OK:
$ref: '#/components/schemas/Woah'`
$ref: '#/components/schemas/Yo'`
leftDoc, rightDoc := test_BuildDoc(left, right)
@@ -221,7 +225,7 @@ func TestCompareSchemas_RefChanged(t *testing.T) {
assert.NotNil(t, changes)
assert.Len(t, changes.Changes, 1)
assert.Equal(t, Modified, changes.Changes[0].ChangeType)
assert.Equal(t, "#/components/schemas/Woah", changes.Changes[0].New)
assert.Equal(t, "string", changes.Changes[0].New)
}
func TestCompareSchemas_RefToInline(t *testing.T) {
@@ -230,7 +234,7 @@ func TestCompareSchemas_RefToInline(t *testing.T) {
Yo:
type: int
OK:
$ref: '#/components/schemas/No'`
$ref: '#/components/schemas/Yo'`
right := `components:
schemas:
@@ -249,8 +253,8 @@ func TestCompareSchemas_RefToInline(t *testing.T) {
assert.NotNil(t, changes)
assert.Len(t, changes.Changes, 1)
assert.Equal(t, Modified, changes.Changes[0].ChangeType)
assert.Equal(t, v3.RefLabel, changes.Changes[0].Property)
assert.Equal(t, "#/components/schemas/No", changes.Changes[0].Original)
assert.Equal(t, v3.TypeLabel, changes.Changes[0].Property)
assert.Equal(t, "int", changes.Changes[0].Original)
}
@@ -260,7 +264,7 @@ func TestCompareSchemas_InlineToRef(t *testing.T) {
Yo:
type: int
OK:
$ref: '#/components/schemas/No'`
$ref: '#/components/schemas/Yo'`
right := `components:
schemas:
@@ -279,8 +283,8 @@ func TestCompareSchemas_InlineToRef(t *testing.T) {
assert.NotNil(t, changes)
assert.Len(t, changes.Changes, 1)
assert.Equal(t, Modified, changes.Changes[0].ChangeType)
assert.Equal(t, v3.RefLabel, changes.Changes[0].Property)
assert.Equal(t, "#/components/schemas/No", changes.Changes[0].New)
assert.Equal(t, v3.TypeLabel, changes.Changes[0].Property)
assert.Equal(t, "int", changes.Changes[0].New)
}