-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Fixed data model typos - Removed update support for Sensing, as it uses TimeStamps which is not supported yet by the update logic - Added more tests for other update supported models
- Loading branch information
1 parent
f620739
commit 3c3270e
Showing
7 changed files
with
221 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package model | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/enbility/spine-go/util" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestStateInformationListDataType_Update(t *testing.T) { | ||
sut := StateInformationListDataType{ | ||
StateInformationData: []StateInformationDataType{ | ||
{ | ||
StateInformationId: util.Ptr(StateInformationIdType(0)), | ||
IsActive: util.Ptr(true), | ||
}, | ||
{ | ||
StateInformationId: util.Ptr(StateInformationIdType(1)), | ||
IsActive: util.Ptr(false), | ||
}, | ||
}, | ||
} | ||
|
||
newData := StateInformationListDataType{ | ||
StateInformationData: []StateInformationDataType{ | ||
{ | ||
StateInformationId: util.Ptr(StateInformationIdType(1)), | ||
IsActive: util.Ptr(true), | ||
}, | ||
}, | ||
} | ||
|
||
// Act | ||
sut.UpdateList(&newData, NewFilterTypePartial(), nil) | ||
|
||
data := sut.StateInformationData | ||
// check the non changing items | ||
assert.Equal(t, 2, len(data)) | ||
item1 := data[0] | ||
assert.Equal(t, 0, int(*item1.StateInformationId)) | ||
assert.Equal(t, true, *item1.IsActive) | ||
// check properties of updated item | ||
item2 := data[1] | ||
assert.Equal(t, 1, int(*item2.StateInformationId)) | ||
assert.Equal(t, true, *item2.IsActive) | ||
} |