Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion test/shared-class.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ var expect = require('chai').expect;
var SharedClass = require('../lib/shared-class');
var factory = require('./helpers/shared-objects-factory.js');
var RemoteObjects = require('../');
function NOOP() {};

describe('SharedClass', function() {
var SomeClass;
Expand Down Expand Up @@ -143,12 +144,13 @@ describe('SharedClass', function() {
SomeClass.prototype.myMethod = function() {};
var METHOD_NAME = 'myMethod';
sc.defineMethod(METHOD_NAME, {
isStatic: true,

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could also use isStatic: false too, but in this case Line 153 needs to be changed to:

expect(sc.findMethodByName('prototype.myMethod').accessType).to.eql('READ');

prototype: true,
accessType: 'READ',
});
var methods = sc.methods().map(getName);
expect(methods).to.contain(METHOD_NAME);
expect(sc.find(METHOD_NAME).accessType).to.eql('READ');
expect(sc.findMethodByName(METHOD_NAME).accessType).to.eql('READ');
});

it('should allow a shared class to resolve dynamically defined functions',
Expand Down Expand Up @@ -189,6 +191,7 @@ describe('SharedClass', function() {
});

describe('sharedClass.find()', function() {
ignoreDeprecationsInThisBlock();
var sc, sm;

beforeEach(function() {
Expand Down Expand Up @@ -239,6 +242,7 @@ describe('SharedClass', function() {
});

describe('sharedClass.disableMethod(methodName, isStatic)', function() {
ignoreDeprecationsInThisBlock();
var sc, sm;
var METHOD_NAME = 'testMethod';
var INST_METHOD_NAME = 'instTestMethod';
Expand Down Expand Up @@ -301,3 +305,13 @@ function getName(obj) {
function getFn(obj) {
return obj.fn;
}

function ignoreDeprecationsInThisBlock() {
before(function() {
process.on('deprecation', NOOP);
});

after(function() {
process.removeListener('deprecation', NOOP);
});
}