Skip to content

Commit

Permalink
fix: update packages and travis config for node 12 & 14 (#124)
Browse files Browse the repository at this point in the history
* fix: update packages and travis config

* fix: update packages / lint

* fix: re-add babel cli
  • Loading branch information
patrickleet authored May 20, 2020
1 parent 4f692e4 commit 003a745
Show file tree
Hide file tree
Showing 9 changed files with 2,824 additions and 4,016 deletions.
4 changes: 2 additions & 2 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"presets": [
["env", {
["@babel/preset-env", {
"targets": {
"node": "current"
}
Expand All @@ -10,6 +10,6 @@
["module-resolver", {
"root": ["./src"]
}],
["transform-object-rest-spread"]
["@babel/plugin-proposal-object-rest-spread"]
]
}
9 changes: 3 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
language: node_js
node_js:
- '8'
- '10'
- '12'
- '14'
cache: npm
notifications:
email: false
before_install:
after_success:
- npm install -g codecov
script:
- npm run test
- codecov
branches:
except:
Expand All @@ -20,5 +17,5 @@ jobs:
if: branch == master && !fork
node_js: node # pre-installed version
script:
- npm install -g semantic-release@^15
- npm install -g semantic-release
- semantic-release
5 changes: 3 additions & 2 deletions __tests__/entity.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class TestEntity extends Entity {
}
this.rehydrate(snapshot, events)
}

method (param) {
this.property2 = param.data
this.digest('method', param)
Expand All @@ -23,14 +24,14 @@ describe('entity', function () {
const snapshot = {
property: true
}
let data = { hello: 'sourced' }
const data = { hello: 'sourced' }
const entity1 = new TestEntity(snapshot)
expect(entity1.property).toBe(true)
entity1.method({ data })

expect(entity1.property2).toEqual(data)

console.warn(entity1)
// console.warn(entity1)

const entity2 = new TestEntity(snapshot, entity1.newEvents)
expect(entity2.property).toEqual(entity1.property)
Expand Down
30 changes: 16 additions & 14 deletions __tests__/entityProxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,41 @@ import Entity from '../src/entityProxy'
import util from 'util'

function User () {
this.apps = {};
this.username = '';
this.password = this.pass = '';
this.apps = {}
this.username = ''
this.password = this.pass = ''

Entity.apply(this, arguments);
Entity.apply(this, arguments)
}

util.inherits(User, Entity);
util.inherits(User, Entity)

User.prototype.grant = function (param) {
this.apps[param.appId] = param;
this.digest('grant', param);
this.emit('granted', param, this);
};
this.apps[param.appId] = param
this.digest('grant', param)
this.emit('granted', param, this)
}

function Inventory () {
this.products = []

Entity.apply(this, arguments);
Entity.apply(this, arguments)
}

util.inherits(Inventory, Entity);
util.inherits(Inventory, Entity)

describe('entityProxy', () => {
it('allows users to use prototypical inheritance with new ES6 class', () => {
let user = new User()
let inventory = new Inventory()
const user = new User()
const inventory = new Inventory()

expect(user.apps).toEqual({})
expect(user.username).toEqual('')
expect(user.pass).toEqual('')
expect(user.on).toBeDefined()
expect(user.digest).toBeDefined()
expect(user.grant).toBeDefined()

expect(inventory.on).toBeDefined()
})
})
})
2 changes: 1 addition & 1 deletion __tests__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ describe('index', () => {
expect(SourcedEntity).toBeDefined()
expect(SourcedValue).toBeDefined()
})
})
})
Loading

0 comments on commit 003a745

Please sign in to comment.