summaryrefslogtreecommitdiff
path: root/ext/librethinkdbxx/test/upstream/changefeeds/squash.yaml
diff options
context:
space:
mode:
Diffstat (limited to 'ext/librethinkdbxx/test/upstream/changefeeds/squash.yaml')
-rw-r--r--ext/librethinkdbxx/test/upstream/changefeeds/squash.yaml62
1 files changed, 62 insertions, 0 deletions
diff --git a/ext/librethinkdbxx/test/upstream/changefeeds/squash.yaml b/ext/librethinkdbxx/test/upstream/changefeeds/squash.yaml
new file mode 100644
index 00000000..fa4ad7f0
--- /dev/null
+++ b/ext/librethinkdbxx/test/upstream/changefeeds/squash.yaml
@@ -0,0 +1,62 @@
+desc: Test changefeed squashing
+table_variable_name: tbl
+tests:
+
+ # Check type
+
+ - py: tbl.changes(squash=true).type_of()
+ rb: tbl.changes(squash:true).type_of()
+ js: tbl.changes({squash:true}).typeOf()
+ ot: ("STREAM")
+
+ # comparison changes
+
+ - cd: normal_changes = tbl.changes().limit(2)
+
+ - py: false_squash_changes = tbl.changes(squash=False).limit(2)
+ js: false_squash_changes = tbl.changes({squash:false}).limit(2)
+ rb: false_squash_changes = tbl.changes(squash:false).limit(2)
+
+ - py: long_squash_changes = tbl.changes(squash=0.5).limit(1)
+ js: long_squash_changes = tbl.changes({squash:0.5}).limit(1)
+ rb: long_squash_changes = tbl.changes(squash:0.5).limit(1)
+
+ - py: squash_changes = tbl.changes(squash=true).limit(1)
+ js: squash_changes = tbl.changes({squash:true}).limit(1)
+ rb: squash_changes = tbl.changes(squash:true).limit(1)
+
+ - cd: tbl.insert({'id':100})['inserted']
+ js: tbl.insert({'id':100})('inserted')
+ ot: 1
+
+ - cd: tbl.get(100).update({'a':1})['replaced']
+ js: tbl.get(100).update({'a':1})('replaced')
+ ot: 1
+
+ - cd: normal_changes
+ ot: ([{'new_val':{'id':100}, 'old_val':null},
+ {'new_val':{'a':1, 'id':100}, 'old_val':{'id':100}}])
+
+ - cd: false_squash_changes
+ ot: ([{'new_val':{'id':100}, 'old_val':null},
+ {'new_val':{'a':1, 'id':100}, 'old_val':{'id':100}}])
+
+ - cd: long_squash_changes
+ ot: ([{'new_val':{'a':1, 'id':100}, 'old_val':null}])
+
+ - cd: squash_changes
+ ot:
+ js: ([{'new_val':{'a':1, 'id':100}, 'old_val':null}])
+ cd: ([{'new_val':{'id':100}, 'old_val':null}])
+
+ # Bad squash values
+
+ - py: tbl.changes(squash=null)
+ rb: tbl.changes(squash:null)
+ js: tbl.changes({squash:null})
+ ot: err('ReqlQueryLogicError', 'Expected BOOL or NUMBER but found NULL.')
+
+ - py: tbl.changes(squash=-10)
+ rb: tbl.changes(squash:-10)
+ js: tbl.changes({squash:-10})
+ ot: err('ReqlQueryLogicError', 'Expected BOOL or a positive NUMBER but found a negative NUMBER.')