Merge branch 'improve_tests' into api-v3

This commit is contained in:
Blade Barringer
2016-01-16 19:24:39 -06:00
5 changed files with 43 additions and 43 deletions

View File

@@ -8,7 +8,6 @@ import {
isEmpty, isEmpty,
set, set,
} from 'lodash'; } from 'lodash';
import { MongoClient as mongo } from 'mongodb';
class ApiObject { class ApiObject {
constructor (options) { constructor (options) {
@@ -22,7 +21,7 @@ class ApiObject {
await updateDocumentInMongo(this._docType, this, options); await updateDocumentInMongo(this._docType, this, options);
_updateLocalParameters (this, options); _updateLocalParameters(this, options);
return this; return this;
} }

View File

@@ -1,3 +1,5 @@
/* eslint-disable no-use-before-define */
import { MongoClient as mongo } from 'mongodb'; import { MongoClient as mongo } from 'mongodb';
const DB_URI = 'mongodb://localhost/habitrpg_test'; const DB_URI = 'mongodb://localhost/habitrpg_test';

View File

@@ -1,7 +1,9 @@
/* eslint-disable no-use-before-define */
import superagent from 'superagent'; import superagent from 'superagent';
const API_TEST_SERVER_PORT = 3003; const API_TEST_SERVER_PORT = 3003;
var apiVersion; let apiVersion;
// Sets up an abject that can make all REST requests // Sets up an abject that can make all REST requests
// If a user is passed in, the uuid and api token of // If a user is passed in, the uuid and api token of
@@ -17,7 +19,7 @@ export function requester (user = {}, additionalSets) {
requester.setApiVersion = (version) => { requester.setApiVersion = (version) => {
apiVersion = version; apiVersion = version;
} };
function _requestMaker (user, method, additionalSets) { function _requestMaker (user, method, additionalSets) {
if (!apiVersion) throw new Error('apiVersion not set'); if (!apiVersion) throw new Error('apiVersion not set');

View File

@@ -1,7 +1,5 @@
/* eslint-disable no-use-before-define */
// Import requester function, set it up for v2, export it // Import requester function, set it up for v2, export it
import { requester } from '../requester' import { requester } from '../requester';
requester.setApiVersion('v2'); requester.setApiVersion('v2');
export { requester }; export { requester };

View File

@@ -1,11 +1,10 @@
import { import {
each,
times, times,
} from 'lodash'; } from 'lodash';
import Q from 'q'; import Q from 'q';
import { v4 as generateUUID } from 'uuid'; import { v4 as generateUUID } from 'uuid';
import { ApiUser, ApiGroup } from '../api-classes'; import { ApiUser, ApiGroup } from '../api-classes';
import { requester } from '../requester' import { requester } from '../requester';
// Creates a new user and returns it // Creates a new user and returns it
// If you need the user to have specific requirements, // If you need the user to have specific requirements,
@@ -106,4 +105,4 @@ export async function createAndPopulateGroup (settings = {}) {
members, members,
invitees, invitees,
}; };
} }