Mike Gerwitz

Activist for User Freedom

aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAustin Schaffer <austin.schaffer@ryansg.com>2019-11-07 17:07:22 -0500
committerAustin Schaffer <austin.schaffer@ryansg.com>2019-11-11 09:29:07 -0500
commitc2458dee78d2844cccb37bd79607af61dd191229 (patch)
tree31d9cc5ff2d909837664d07fe60da4cdc295be5f /test
parent31a820a34f2694c3d144488e75580279c85929bc (diff)
downloadliza-c2458dee78d2844cccb37bd79607af61dd191229.tar.gz
liza-c2458dee78d2844cccb37bd79607af61dd191229.tar.bz2
liza-c2458dee78d2844cccb37bd79607af61dd191229.zip
[DEV-5312] Convert most parts of RatingService Publish to TS
Diffstat (limited to 'test')
-rw-r--r--test/bucket/delta.ts90
-rw-r--r--test/server/request/DataProcessorTest.ts2
2 files changed, 91 insertions, 1 deletions
diff --git a/test/bucket/delta.ts b/test/bucket/delta.ts
index ba1d192..a729f29 100644
--- a/test/bucket/delta.ts
+++ b/test/bucket/delta.ts
@@ -89,6 +89,96 @@ describe( 'Delta', () =>
dest_data: { foo: [ '' ] },
expected: {},
},
+ {
+ label: "",
+ src_data: { foo: [ 'bar', 'baz' ] },
+ dest_data: { foo: [ 'change', 'baz' ] },
+ data: { foo: [ 'change', 'baz' ] },
+ diff: { foo: [ 'change' ] },
+ },
+ {
+ label: "",
+ src_data: { foo: [ 'bar', 'baz' ] },
+ dest_data: { foo: [ 'bar', 'change' ] },
+ data: { foo: [ 'bar', 'change' ] },
+ diff: { foo: [ , 'change' ] },
+ },
+ {
+ label: "",
+ src_data: { foo: [ 'bar', 'baz' ] },
+ dest_data: { foo: [ undefined, 'change' ] },
+ data: { foo: [ 'bar', 'change' ] },
+ diff: { foo: [ , 'change' ] },
+ },
+ {
+ label: "",
+ src_data: { foo: [ 'bar', 'baz' ] },
+ dest_data: { foo: [ undefined, 'baz' ] },
+ data: { foo: [ 'bar', 'baz' ] },
+ diff: {},
+ },
+ {
+ label: "",
+ src_data: { foo: [ 'bar', 'baz' ] },
+ dest_data: { foo: [ 'bar', undefined ] },
+ data: { foo: [ 'bar', 'baz' ] },
+ diff: {},
+ },
+ {
+ label: "",
+ src_data: { foo: [ 'bar', 'baz' ] },
+ dest_data: { foo: [ 'bar', null ] },
+ data: { foo: [ 'bar' ] },
+ diff: { foo: [ , null ] },
+ },
+ {
+ label: "",
+ src_data: { foo: [ 'bar', 'baz' ] },
+ dest_data: { foo: [ 'bar', 'baz', null ] },
+ data: { foo: [ 'bar', 'baz' ] },
+ diff: {},
+ },
+ {
+ label: "",
+ src_data: { foo: [ 'bar', 'baz' ] },
+ dest_data: { foo: [ 'bar', 'baz', 'quux' ] },
+ data: { foo: [ 'bar', 'baz', 'quux' ] },
+ diff: { foo: [ , , 'quux' ]},
+ },
+ {
+ label: "",
+ src_data: { foo: [ 'bar', 'baz' ] },
+ dest_data: { foo: [] },
+ data: { foo: [ 'bar', 'baz' ] },
+ diff: {},
+ },
+
+ // null not at end of set means unchanged
+ {
+ label: "",
+ src_data: { foo: [ 'bar', 'baz', 'quux' ] },
+ dest_data: { foo: [ null, null, 'quux' ] },
+ data: { foo: [ 'bar', 'baz', 'quux' ] },
+ diff: {},
+ },
+ // but the last one is
+ {
+ label: "",
+ src_data: { foo: [ 'bar', 'baz', 'quux' ] },
+ dest_data: { foo: [ null, 'baz', null ] },
+ data: { foo: [ 'bar', 'baz' ] },
+ diff: { foo: [ , , null ] },
+ },
+ // given a string of nulls, only the last one is terminating; the
+ // rest are interpreted as undefined (because JSON serializes
+ // undefined values to `null' -_-)
+ {
+ label: "",
+ src_data: { foo: [ 'bar', 'baz', 'quux' ] },
+ dest_data: { foo: [ null, null, null ] },
+ data: { foo: [ 'bar', 'baz' ] },
+ diff: { foo: [ , , null ] },
+ },
] ).forEach( ( { label, src_data, dest_data, expected } ) =>
{
it( label, () =>
diff --git a/test/server/request/DataProcessorTest.ts b/test/server/request/DataProcessorTest.ts
index d0e52d8..a3a4d0e 100644
--- a/test/server/request/DataProcessorTest.ts
+++ b/test/server/request/DataProcessorTest.ts
@@ -503,7 +503,7 @@ function createStubs(
function createStubUserRequest( internal: boolean )
{
- return {
+ return <UserRequest>{
getSession: () => ( {
isInternal: () => internal
} )