Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TRITON-1653 net-agent thinks that networks are always changing
Reviewed by: Jordan Hendricks <jordan.hendricks@joyent.com> Approved by: Jordan Hendricks <jordan.hendricks@joyent.com>
- Loading branch information
Showing
4 changed files
with
57 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
*/ | ||
|
||
/* | ||
* Copyright (c) 2019 Joyent, Inc. | ||
*/ | ||
|
||
/* | ||
* Tests that verify that NIC changes made in NAPI are reflected locally. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
var mod_common = require('../../lib/common'); | ||
var test = require('tape'); | ||
|
||
// --- Tests | ||
|
||
test('hasChanged() tests', function (t) { | ||
var OBJ1 = { a: 5, b: [ 1, 2, 3, 4 ] }; | ||
var OBJ2 = { a: 6, b: [ 1, 2, 3, 4 ] }; | ||
var OBJ3 = { a: 5, b: [ 1, 2, 3, 5 ] }; | ||
|
||
t.equal(mod_common.hasChanged([], OBJ1, null), true); | ||
t.equal(mod_common.hasChanged([ 'a' ], OBJ1, OBJ2), true); | ||
t.equal(mod_common.hasChanged([ 'b' ], OBJ1, OBJ3), true); | ||
|
||
t.equal(mod_common.hasChanged([ 'a', 'b' ], OBJ1, OBJ3), true); | ||
t.equal(mod_common.hasChanged([ 'a', 'b' ], OBJ1, OBJ2), true); | ||
t.equal(mod_common.hasChanged([ 'a', 'b' ], OBJ2, OBJ3), true); | ||
|
||
t.equal(mod_common.hasChanged([ 'a', 'b', 'c' ], OBJ1, OBJ3), true); | ||
t.equal(mod_common.hasChanged([ 'a', 'b', 'c' ], OBJ1, OBJ2), true); | ||
t.equal(mod_common.hasChanged([ 'a', 'b', 'c' ], OBJ2, OBJ3), true); | ||
|
||
t.equal(mod_common.hasChanged([], {}, {}), false); | ||
t.equal(mod_common.hasChanged([], OBJ1, OBJ2), false); | ||
t.equal(mod_common.hasChanged([ 'a' ], OBJ1, OBJ3), false); | ||
t.equal(mod_common.hasChanged([ 'b' ], OBJ1, OBJ2), false); | ||
t.equal(mod_common.hasChanged([ 'c' ], OBJ1, OBJ2), false); | ||
|
||
t.equal(mod_common.hasChanged([], OBJ1, OBJ1), false); | ||
t.equal(mod_common.hasChanged([ 'a' ], OBJ1, OBJ1), false); | ||
t.equal(mod_common.hasChanged([ 'b' ], OBJ1, OBJ1), false); | ||
t.equal(mod_common.hasChanged([ 'c' ], OBJ1, OBJ1), false); | ||
|
||
t.end(); | ||
}); |