Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vearutop committed Oct 7, 2022
1 parent 0e45db3 commit f87816f
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test-examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
test:
strategy:
matrix:
go-version: [1.18.x ]
go-version: [1.19.x ]
runs-on: ubuntu-latest
steps:
- name: Install Go stable
Expand Down
2 changes: 1 addition & 1 deletion _examples/advanced-generic/_testdata/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@
"schema":{"type":"string","description":"Sample response header."}
}
},
"content":{"text/csv":{"schema":{}}}
"content":{"text/csv":{"schema":{"type":"string"}}}
},
"500":{
"description":"Internal Server Error",
Expand Down
6 changes: 3 additions & 3 deletions _examples/advanced-generic/router_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ package main

import (
"encoding/json"
"io/ioutil"
"net/http"
"net/http/httptest"
"os"
"testing"

"github.com/stretchr/testify/assert"
Expand All @@ -28,10 +28,10 @@ func TestNewRouter(t *testing.T) {
actualSchema, err := assertjson.MarshalIndentCompact(json.RawMessage(rw.Body.Bytes()), "", " ", 120)
require.NoError(t, err)

expectedSchema, err := ioutil.ReadFile("_testdata/openapi.json")
expectedSchema, err := os.ReadFile("_testdata/openapi.json")
require.NoError(t, err)

if !assertjson.Equal(t, expectedSchema, rw.Body.Bytes(), string(actualSchema)) {
require.NoError(t, ioutil.WriteFile("_testdata/openapi_last_run.json", actualSchema, 0o600))
require.NoError(t, os.WriteFile("_testdata/openapi_last_run.json", actualSchema, 0o600))
}
}
2 changes: 1 addition & 1 deletion _examples/advanced/_testdata/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@
"schema":{"type":"string","description":"Sample response header."}
}
},
"content":{"text/csv":{"schema":{}}}
"content":{"text/csv":{"schema":{"type":"string"}}}
},
"500":{
"description":"Internal Server Error",
Expand Down
6 changes: 3 additions & 3 deletions _examples/advanced/router_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package main

import (
"encoding/json"
"io/ioutil"
"net/http"
"net/http/httptest"
"os"
"testing"

"github.com/stretchr/testify/assert"
Expand All @@ -26,10 +26,10 @@ func TestNewRouter(t *testing.T) {
actualSchema, err := assertjson.MarshalIndentCompact(json.RawMessage(rw.Body.Bytes()), "", " ", 120)
require.NoError(t, err)

expectedSchema, err := ioutil.ReadFile("_testdata/openapi.json")
expectedSchema, err := os.ReadFile("_testdata/openapi.json")
require.NoError(t, err)

if !assertjson.Equal(t, expectedSchema, rw.Body.Bytes(), string(actualSchema)) {
require.NoError(t, ioutil.WriteFile("_testdata/openapi_last_run.json", actualSchema, 0o600))
require.NoError(t, os.WriteFile("_testdata/openapi_last_run.json", actualSchema, 0o600))
}
}
4 changes: 2 additions & 2 deletions openapi/collector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ func TestCollector_Collect_requestMapping(t *testing.T) {
},
{
"name":"in_cookie","in":"cookie",
"schema":{"type":"string","format":"date-time"}
"schema":{"type":"string","format":"date-time","nullable":true}
},
{
"name":"X-In-Header","in":"header",
Expand Down Expand Up @@ -193,7 +193,7 @@ func TestCollector_Collect_requestMapping(t *testing.T) {
},
{
"name":"in_cookie","in":"cookie",
"schema":{"type":"string","format":"date-time"}
"schema":{"type":"string","format":"date-time","nullable":true}
},
{
"name":"X-In-Header","in":"header",
Expand Down

0 comments on commit f87816f

Please sign in to comment.