Skip to content

Commit

Permalink
feat: update latest layer
Browse files Browse the repository at this point in the history
  • Loading branch information
ernado committed Nov 27, 2023
1 parent b1a34a7 commit 6baa960
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
3 changes: 2 additions & 1 deletion load.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ var Layers = []int{
145,
155,
158,
164,
}

// LayerLatest is id of the latest layer.
const LayerLatest = 158
const LayerLatest = 164

// LayerExists returns true if layer is included in package.
func LayerExists(layer int) bool {
Expand Down
22 changes: 22 additions & 0 deletions load_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,34 @@ package getdoc
import (
"errors"
"fmt"
"strconv"
"strings"
"testing"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

func TestSchemas(t *testing.T) {
files, err := data.ReadDir("_schema")
require.NoError(t, err)
var latest int
for _, file := range files {
layer, err := strconv.Atoi(strings.TrimSuffix(file.Name(), ".json"))
if err != nil {
continue
}
assert.Contains(t, Layers, layer, "layer should be in Layers list")
if layer > latest {
latest = layer
}
}
if latest == 0 {
t.Fatal("no layers found")
}
require.Equal(t, latest, LayerLatest, "maximum layer should be latest")
}

func TestLoad(t *testing.T) {
for _, layer := range append(Layers, LayerLatest) {
t.Run(fmt.Sprintf("%d", layer), func(t *testing.T) {
Expand Down

0 comments on commit 6baa960

Please sign in to comment.