Skip to content

Commit

Permalink
Merge pull request #163 from davesag/feature/161/allow-basic-type-con…
Browse files Browse the repository at this point in the history
…structors

[Bug fix, #161] allow basic type constructors
  • Loading branch information
davesag authored Sep 26, 2020
2 parents 4661c2d + 96a6df1 commit be3e8f1
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 19 deletions.
4 changes: 2 additions & 2 deletions src/dataTypes.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const noop = require('./types/noop')
const Noop = require('./types/Noop')
const NumericType = require('./types/NumericType')
const StringType = require('./types/StringType')
const basicTypes = require('./constants/basicTypes')
Expand All @@ -7,7 +7,7 @@ const stringTypes = require('./constants/stringTypes')
const deferrables = require('./constants/deferrables')

const basicDataTypes = basicTypes.reduce((acc, elem) => {
acc[elem] = noop
acc[elem] = Noop
return acc
}, {})

Expand Down
5 changes: 5 additions & 0 deletions src/types/Noop.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
function Noop() {
return Noop
}

module.exports = Noop
3 changes: 0 additions & 3 deletions src/types/noop.js

This file was deleted.

4 changes: 2 additions & 2 deletions test/unit/dataTypes.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const { expect } = require('chai')

const dataTypes = require('../../src/dataTypes')
const noop = require('../../src/types/noop')
const Noop = require('../../src/types/Noop')
const NumericType = require('../../src/types/NumericType')
const StringType = require('../../src/types/StringType')

Expand Down Expand Up @@ -69,7 +69,7 @@ describe('dataTypes', () => {

it('has basicTypes', () => {
basicTypes.forEach(type => {
expect(dataTypes).to.have.property(type, noop)
expect(dataTypes).to.have.property(type, Noop)
})
})

Expand Down
12 changes: 12 additions & 0 deletions test/unit/types/Noop.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const { expect } = require('chai')
const Noop = require('../../../src/types/Noop')

describe('src/types/Noop', () => {
it('is a function', () => {
expect(Noop).to.be.a('function')
})

it('returns itself', () => {
expect(Noop()).to.equal(Noop)
})
})
12 changes: 0 additions & 12 deletions test/unit/types/noop.test.js

This file was deleted.

0 comments on commit be3e8f1

Please sign in to comment.