Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix spurious test failure with "creates new identifiers" [OSF-6970] #6655

Closed
wants to merge 9 commits into from
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,10 @@ env:
- LIBPCRE_DEB="libpcre3_8.31-2ubuntu2.3_amd64.deb"
- VARNISH_DEB="varnish_4.1.0-1~trusty_amd64.deb"
matrix:
- TEST_BUILD="osf"
- TEST_BUILD="else"
- TEST_BUILD="varnish"

before_install:
- npm ls sinon || echo ''
# cache directories
- |
mkdir -p $HOME/.cache/downloads
Expand Down
5 changes: 3 additions & 2 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@
"osf-panel": "https://github.com/CenterForOpenScience/osf-panel.git#fda8e05d9f3ba8ed7bd43b46ceffe265b3d73b39",
"styles": "https://github.com/CenterForOpenScience/styles.git#master",
"locales": "https://github.com/CenterForOpenScience/locales.git#d2b612f8a6f764cbd66e67238636fac3888a7736",
"raven-js": "2.1.0",
"raven-js": "3.x.x",
"zeroclipboard": "2.1.6",
"osf-style": "https://github.com/CenterForOpenScience/osf-style.git#5dcf5997ad2808ffc7c8564f94cde102bf7a4a96",
"At.js": "jquery.atwho#e18af47fdcb327605533a9da259225176e3013c8",
"academicons": "1.7.0"
"academicons": "1.7.0",
"stacktrace-js": "1.3.x"
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"pikaday": "^1.3.2",
"pretty-data": "^0.40.0",
"pym.js": "^0.4.1",
"raven": "^0.7.2",
"raven": "1.x.x",
"raw-loader": "^0.5.1",
"share": "0.7.27",
"style-loader": "^0.8.3",
Expand Down
1 change: 0 additions & 1 deletion tasks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,6 @@ def test_travis_varnish(ctx):
Run the fast and quirky JS tests and varnish tests in isolation
"""
test_js(ctx)
test_varnish(ctx)


@task
Expand Down
1 change: 1 addition & 0 deletions webpack.common.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ var entry = {
'lodash.get',
'js-cookie',
'URIjs',
'stacktrace-js',
// Common internal modules
'js/fangorn',
'js/citations',
Expand Down
22 changes: 19 additions & 3 deletions website/static/js/contribAdder.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ var NodeSelectTreebeard = require('js/nodeSelectTreebeard');
var m = require('mithril');
var projectSettingsTreebeardBase = require('js/projectSettingsTreebeardBase');

var Raven = require('raven-js'); // XXX Debugging!

function Contributor(data) {
$.extend(this, data);
Expand Down Expand Up @@ -245,6 +246,7 @@ AddContributorViewModel = oop.extend(Paginator, {
self.notification(false);
var url = $osf.apiV2Url('nodes/' + window.contextVars.node.id + '/contributors/');

console.log('contrib adding');
return $.ajax({
url: url,
type: 'GET',
Expand All @@ -254,10 +256,24 @@ AddContributorViewModel = oop.extend(Paginator, {
xhrFields: {withCredentials: true},
processData: false
}).done(function (response) {
var contributors = response.data.map(function (contributor) {
// contrib ID has the form <nodeid>-<userid>
return contributor.id.split('-')[1];
Raven.captureBreadcrumb({
message: 'done adding contrib',
category: 'debugging',
level: 'info',
data: {
response: response,
'response.data': response ? response.data : 'n/a'
}
});
try {
var contributors = response.data.map(function (contributor) {
// contrib ID has the form <nodeid>-<userid>
return contributor.id.split('-')[1];
});
} catch(e) {
Raven.captureException(e);
throw e;
}
self.contributors(contributors);
});
},
Expand Down
1 change: 1 addition & 0 deletions website/static/js/nodeControl.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ var ProjectViewModel = function(data, options) {

self.createIdentifiers = function() {
// Only show loading indicator for slow responses
console.log('creating identifiers');
var timeout = setTimeout(function() {
self.idCreationInProgress(true); // show loading indicator
}, 500);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ var TestSubclassVM = oop.extend(FolderPickerNodeConfigVM, {
}
});

describe.skip('FolderPickerNodeConfigViewModel', () => {
describe('FolderPickerNodeConfigViewModel', () => {

var settingsUrl = '/api/v1/12345/addon/config/';
var endpoints = [{
Expand Down
2 changes: 1 addition & 1 deletion website/static/js/tests/contributors.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ var URLs = {
fetchUsers: '/api/v1/user/search'
};

describe.skip('addContributors', () => {
describe('addContributors', () => {
describe('viewModel', () => {
var getContributorsResult = {
contributors: [
Expand Down
2 changes: 1 addition & 1 deletion website/static/js/tests/forgotPassword.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ var formViewModel = require('js/formViewModel');
// Add sinon asserts to chai.assert, so we can do assert.calledWith instead of sinon.assert.calledWith
sinon.assert.expose(assert, {prefix: ''});

describe.skip('forgotPassword', () => {
describe('forgotPassword', () => {
describe('ViewModels', () => {

describe('ForgtoPasswordViewModel', () => {
Expand Down
2 changes: 1 addition & 1 deletion website/static/js/tests/formModelView.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('formModelView', () => {
});
});

describe.skip('ViewModel', () => {
describe('ViewModel', () => {
var vm;

beforeEach(() => {
Expand Down
2 changes: 1 addition & 1 deletion website/static/js/tests/licensePicker.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ var license = licenses.MIT;
// proxy attribute to match server data
license.copyright_holders = [];

describe.skip('LicensePicker', () => {
describe('LicensePicker', () => {

before(() => {
window.contextVars = $.extend({}, window.contextVars || {}, {
Expand Down
3 changes: 2 additions & 1 deletion website/static/js/tests/nodeControl.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ var nodeData = {
user: {permissions: ['read', 'write', 'admin']}
};

describe.skip('nodeControl', () => {
describe('nodeControl', () => {
describe('ViewModels', () => {
describe('ProjectViewModel', () => {
var server;
Expand Down Expand Up @@ -77,6 +77,7 @@ describe.skip('nodeControl', () => {
assert.equal(vm.arkUrl(), 'http://ezid.cdlib.org/id/ark:/24601');
});
it('creates new identifiers', (done) => {
console.log('wat?');
vm.createIdentifiers().always(() => {
assert.equal(vm.doi(), '24601');
assert.equal(vm.ark(), '24601');
Expand Down
2 changes: 1 addition & 1 deletion website/static/js/tests/oop.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ sinon.assert.expose(assert, {prefix: ''});
var oop = require('js/oop');


describe.skip('oop', () => {
describe('oop', () => {
var constructorSpy = new sinon.spy();
var methodSpy = new sinon.spy();
var overrideSpy = new sinon.spy();
Expand Down
2 changes: 1 addition & 1 deletion website/static/js/tests/paginator.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ var TestPaginator = oop.extend(Paginator, {
});


describe.skip('Paginator', () => {
describe('Paginator', () => {
var paginator;
var numberOfPages;
var currentPage;
Expand Down
2 changes: 1 addition & 1 deletion website/static/js/tests/profile.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ var urlData = require('json!../../urlValidatorTest.json');
// Add sinon asserts to chai.assert, so we can do assert.calledWith instead of sinon.assert.calledWith
sinon.assert.expose(assert, {prefix: ''});

describe.skip('profile', () => {
describe('profile', () => {
sinon.collection.restore();
describe('ViewModels', () => {

Expand Down
2 changes: 1 addition & 1 deletion website/static/js/tests/saveManager.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ var SaveManager = require('js/saveManager');
var url = 'http://foo.com';
var sm = new SaveManager(url);

describe.skip('SaveManager', () => {
describe('SaveManager', () => {
var server;
beforeEach(() => {
server = sinon.fakeServer.create();
Expand Down
2 changes: 1 addition & 1 deletion website/static/js/tests/tests.webpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

// Configure raven with a fake DSN to avoid errors in test output
var Raven = require('raven-js');
Raven.config('http://abc@example.com:80/2');
Raven.config('https://1332f6ba2dd04bca94b139bebbab7644@sentry.io/122808');

// Include all files that end with .test.js (core tests)
var context = require.context('.', true, /.*test\.js$/); //make sure you have your directory and regex test set correctly!
Expand Down