nodejs-should/0001-Fix-flaky-tests.patch
2020-09-01 17:13:41 +08:00

67 lines
3.1 KiB
Diff

From 4a83d6ed61f212fdf84a7de70e5bf8ef18779b07 Mon Sep 17 00:00:00 2001
From: Denis Bardadym <bardadymchik@gmail.com>
Date: Fri, 10 Jun 2016 13:59:33 +0300
Subject: [PATCH] Fix flaky tests
---
test/ext/match.test.js | 8 ++++----
test/ext/property.test.js | 6 +++---
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/test/ext/match.test.js b/test/ext/match.test.js
index 537be32632a716bfbbfea63b31c608ad22878eee..81417de5dc49eb99b53613f8a022eea31daecddf 100644
--- a/test/ext/match.test.js
+++ b/test/ext/match.test.js
@@ -119,21 +119,21 @@ describe('match', function() {
d.should.not.match(ds);
ds.should.not.match(d);
err(function() {
({ a: 10, b: 'abc', c: { d: 10 }, d: 0 }).should
- .match({ a: 11, b: /c$/, c: function(it) {
+ .match({ a: 11, b: /c$/, c: function c(it) {
return it.should.have.property('d', 10);
}});
- }, "expected Object { a: 10, b: 'abc', c: Object { d: 10 }, d: 0 } to match Object { a: 11, b: /c$/, c: Function { name: '' } }\n not matched properties: a (10)\n matched properties: b, c");
+ }, "expected Object { a: 10, b: 'abc', c: Object { d: 10 }, d: 0 } to match Object { a: 11, b: /c$/, c: Function { name: 'c' } }\n not matched properties: a (10)\n matched properties: b, c");
err(function() {
({ a: 10, b: 'abc', c: { d: 10 }, d: 0 }).should.not
- .match({ a: 10, b: /c$/, c: function(it) {
+ .match({ a: 10, b: /c$/, c: function c(it) {
return it.should.have.property('d', 10);
}});
- }, "expected Object { a: 10, b: 'abc', c: Object { d: 10 }, d: 0 } not to match Object { a: 10, b: /c$/, c: Function { name: '' } }\n matched properties: a, b, c (false negative fail)");
+ }, "expected Object { a: 10, b: 'abc', c: Object { d: 10 }, d: 0 } not to match Object { a: 10, b: /c$/, c: Function { name: 'c' } }\n matched properties: a, b, c (false negative fail)");
});
it('test each property match(function)', function() {
[10, 11, 12].should.matchEach(function(it) {
return it >= 10;
diff --git a/test/ext/property.test.js b/test/ext/property.test.js
index 4695882eccb1e5b9e3ab53787383e02f5949ddfa..8aa17b885803b7d86674bd28b9c178c93abe509c 100644
--- a/test/ext/property.test.js
+++ b/test/ext/property.test.js
@@ -49,15 +49,15 @@ describe('property', function() {
err(function() {
'asd'.should.not.have.property('length', 3);
}, "expected 'asd' not to have property length of 3 (false negative fail)");
err(function() {
- var obj = { f: function() {} };
- var f1 = function() {};
+ var obj = { f: function f() {} };
+ var f1 = function f1() {};
f1.a = 1;
obj.should.have.property('f', f1);
- }, "expected Object { f: Function { name: '' } } to have property f of Function { a: 1, name: '' } (got Function { name: '' })");
+ }, "expected Object { f: Function { name: 'f' } } to have property f of Function { a: 1, name: 'f1' } (got Function { name: 'f' })");
err(function() {
({a: {b: 1}}).should.have.property('a')
.and.have.property('b', 100);
}, "expected Object { b: 1 } to have property b of 100 (got 1)");
--
2.9.3