Skip to content

Commit

Permalink
tests for Object.ID() (#118)
Browse files Browse the repository at this point in the history
  • Loading branch information
srerickson authored Feb 14, 2025
1 parent 44d6570 commit 031e224
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions object_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ func testObjectExample(t *testing.T) {
obj, err := ocfl.NewObject(ctx, tmpFS, "new-object-01")
be.NilErr(t, err)
be.False(t, obj.Exists()) // the object doesn't exist yet
be.Zero(t, obj.ID()) // its ID isn't set

// commit new object version from bytes:
v1Content := map[string][]byte{
Expand Down Expand Up @@ -75,6 +76,7 @@ func testObjectExample(t *testing.T) {
Spec: ocfl.Spec1_1,
})
be.NilErr(t, err)
be.Equal(t, "new-object-01", obj.ID())
be.Equal(t, ocfl.Spec1_1, obj.Inventory().Spec())
be.Nonzero(t, obj.Inventory().Version(2).State().PathMap()["new-data.csv"])
be.DeepEqual(t, []string{"md5"}, obj.Inventory().FixityAlgorithms())
Expand Down
1 change: 1 addition & 0 deletions root_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ func TestRoot(t *testing.T) {
objID := "object-1"
obj, err := newRoot.NewObject(ctx, objID)
be.NilErr(t, err)
be.Equal(t, obj.ID(), objID)
stage, err := ocfl.StageBytes(map[string][]byte{
"file.txt": []byte("readme readme readme"),
}, digest.SHA256)
Expand Down

0 comments on commit 031e224

Please sign in to comment.