test/unit/library_function_test.rb in hqmf2js-1.2.1 vs test/unit/library_function_test.rb in hqmf2js-1.3.0
- old
+ new
@@ -15,35 +15,35 @@
@context.eval('typeof allTrue').must_equal "function"
@context.eval('typeof atLeastOneTrue').must_equal "function"
end
def test_all_true
- @context.eval('allTrue(1,new Boolean(false),new Boolean(false),new Boolean(false)).isTrue()').must_equal false
- @context.eval('allTrue(1,new Boolean(false),new Boolean(true),new Boolean(false)).isTrue()').must_equal false
- @context.eval('allTrue(1,new Boolean(true),new Boolean(true),new Boolean(true)).isTrue()').must_equal true
- @context.eval('allTrue(1).isTrue()').must_equal false
+ @context.eval('allTrue(1,null,null,new Boolean(false),new Boolean(false),new Boolean(false))().isTrue()').must_equal false
+ @context.eval('allTrue(1,null,null,new Boolean(false),new Boolean(true),new Boolean(false))().isTrue()').must_equal false
+ @context.eval('allTrue(1,null,null,new Boolean(true),new Boolean(true),new Boolean(true))().isTrue()').must_equal true
+ @context.eval('allTrue(1,null,null)().isTrue()').must_equal false
end
def test_at_least_one_true
- @context.eval('atLeastOneTrue(1,new Boolean(true),new Boolean(false),new Boolean(false)).isTrue()').must_equal true
- @context.eval('atLeastOneTrue(1,new Boolean(true),new Boolean(true),new Boolean(true)).isTrue()').must_equal true
- @context.eval('atLeastOneTrue(1,new Boolean(false),new Boolean(false),new Boolean(false)).isTrue()').must_equal false
- @context.eval('atLeastOneTrue(1).isTrue()').must_equal false
+ @context.eval('atLeastOneTrue(1,null,null,new Boolean(true),new Boolean(false),new Boolean(false))().isTrue()').must_equal true
+ @context.eval('atLeastOneTrue(1,null,null,new Boolean(true),new Boolean(true),new Boolean(true))().isTrue()').must_equal true
+ @context.eval('atLeastOneTrue(1,null,null,new Boolean(false),new Boolean(false),new Boolean(false))().isTrue()').must_equal false
+ @context.eval('atLeastOneTrue(1,null,null)().isTrue()').must_equal false
end
def test_all_false
- @context.eval('allFalse(1,new Boolean(false),new Boolean(false),new Boolean(false)).isTrue()').must_equal true
- @context.eval('allFalse(1,new Boolean(false),new Boolean(true),new Boolean(false)).isTrue()').must_equal false
- @context.eval('allFalse(1,new Boolean(true),new Boolean(true),new Boolean(true)).isTrue()').must_equal false
- @context.eval('allFalse(1).isTrue()').must_equal false
+ @context.eval('allFalse(1,null,null,new Boolean(false),new Boolean(false),new Boolean(false))().isTrue()').must_equal true
+ @context.eval('allFalse(1,null,null,new Boolean(false),new Boolean(true),new Boolean(false))().isTrue()').must_equal false
+ @context.eval('allFalse(1,null,null,new Boolean(true),new Boolean(true),new Boolean(true))().isTrue()').must_equal false
+ @context.eval('allFalse(1,null,null)().isTrue()').must_equal false
end
def test_at_least_one_false
- @context.eval('atLeastOneFalse(1,new Boolean(true),new Boolean(false),new Boolean(false)).isTrue()').must_equal true
- @context.eval('atLeastOneFalse(1,new Boolean(true),new Boolean(true),new Boolean(true)).isTrue()').must_equal false
- @context.eval('atLeastOneFalse(1,new Boolean(false),new Boolean(false),new Boolean(false)).isTrue()').must_equal true
- @context.eval('atLeastOneFalse(1).isTrue()').must_equal false
+ @context.eval('atLeastOneFalse(1,null,null,new Boolean(true),new Boolean(false),new Boolean(false))().isTrue()').must_equal true
+ @context.eval('atLeastOneFalse(1,null,null,new Boolean(true),new Boolean(true),new Boolean(true))().isTrue()').must_equal false
+ @context.eval('atLeastOneFalse(1,null,null,new Boolean(false),new Boolean(false),new Boolean(false))().isTrue()').must_equal true
+ @context.eval('atLeastOneFalse(1,null,null)().isTrue()').must_equal false
end
def test_patient_extensions
@context.eval('typeof hQuery.Patient.prototype.procedureResults').must_equal "function"
@context.eval('typeof hQuery.Patient.prototype.laboratoryTests').must_equal "function"
@@ -51,10 +51,11 @@
@context.eval('typeof hQuery.Patient.prototype.allProblems').must_equal "function"
@context.eval('typeof hQuery.Patient.prototype.allDevices').must_equal "function"
@context.eval('typeof hQuery.Patient.prototype.activeDiagnoses').must_equal "function"
@context.eval('typeof hQuery.Patient.prototype.inactiveDiagnoses').must_equal "function"
@context.eval('typeof hQuery.Patient.prototype.resolvedDiagnoses').must_equal "function"
+ @context.eval('typeof hQuery.Patient.prototype.getEvents').must_equal "function"
end
def test_code_list
@context.eval('(new CodeList({"foo": [10,11]})).match(10)').must_equal true
@context.eval('(new CodeList({"foo": [10,11]})).match({"code": 10})').must_equal true
@@ -498,14 +499,14 @@
end
def test_ordinal_operators
# Ordinal operators
- ts20100101 = '{"timeStamp": function() {return new Date(2010,0,1);}}'
- ts20100201 = '{"timeStamp": function() {return new Date(2010,1,1);}}'
- ts20100301 = '{"timeStamp": function() {return new Date(2010,2,1);}}'
- ts20100401 = '{"timeStamp": function() {return new Date(2010,3,1);}}'
- ts20100501 = '{"timeStamp": function() {return new Date(2010,4,1);}}'
+ ts20100101 = '{"timeStamp": function() {return new Date(2010,0,1);}, "asIVL_TS": function() {return new IVL_TS(new TS("20100101"), new TS("20100101"));}}'
+ ts20100201 = '{"timeStamp": function() {return new Date(2010,1,1);}, "asIVL_TS": function() {return new IVL_TS(new TS("20100201"), new TS("20100201"));}}'
+ ts20100301 = '{"timeStamp": function() {return new Date(2010,2,1);}, "asIVL_TS": function() {return new IVL_TS(new TS("20100301"), new TS("20100301"));}}'
+ ts20100401 = '{"timeStamp": function() {return new Date(2010,3,1);}, "asIVL_TS": function() {return new IVL_TS(new TS("20100401"), new TS("20100401"));}}'
+ ts20100501 = '{"timeStamp": function() {return new Date(2010,4,1);}, "asIVL_TS": function() {return new IVL_TS(new TS("20100501"), new TS("20100501"));}}'
events0 = "[]"
events1 = "[#{ts20100101}]"
events2 = "[#{ts20100101},#{ts20100201}]"
events3 = "[#{ts20100101},#{ts20100201},#{ts20100301}]"
events4 = "[#{ts20100101},#{ts20100201},#{ts20100301},#{ts20100401}]"
\ No newline at end of file