Skip to content

Commit dc2743f

Browse files
author
Lee Richmond
committed
Allow Config.setup() to be called without options
1 parent 34d2deb commit dc2743f

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

src/configuration.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,16 @@ import Model from './model';
44
import Attribute from './attribute';
55
import Logger from './logger';
66

7+
let ctx = this;
8+
79
export default class Config {
810
static models: Array<typeof Model> = [];
911
static typeMapping: Object = {};
1012
static logger: Logger = new Logger();
1113

12-
static setup(options : Object) : void {
14+
static setup(options? : Object) : void {
15+
if (!options) options = {};
16+
1317
for (let model of this.models) {
1418
this.typeMapping[model.jsonapiType] = model;
1519

test/unit/configuration-test.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@ import { expect, sinon } from '../test-helper';
22
import { Config } from '../../src/index';
33
import { Author } from '../fixtures';
44

5+
describe('#setup()', function() {
6+
it('can be called without options', function() {
7+
let setup = function() {
8+
Config.setup();
9+
}
10+
expect(setup).to.not.throw();
11+
});
12+
});
13+
514
describe('#modelForType', function() {
615
it('returns the relevant class for jsonapiType', function() {
716
expect(Config.modelForType('authors')).to.eq(Author);

0 commit comments

Comments
 (0)