Skip to content

Commit

Permalink
v4.6.5
Browse files Browse the repository at this point in the history
chore: Updated npm deps.
test: Added symbol property tests.
  • Loading branch information
cb1kenobi committed Oct 31, 2019
1 parent cbcc229 commit fbfa69f
Show file tree
Hide file tree
Showing 5 changed files with 569 additions and 580 deletions.
15 changes: 8 additions & 7 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@ exports.clean = parallel(cleanCoverage, cleanDist, cleanDocs);
/*
* lint tasks
*/
function lint(pattern) {
async function lint(pattern) {
return gulp.src(pattern)
.pipe($.plumber())
.pipe($.eslint())
.pipe($.eslint.format())
.pipe($.eslint.failAfterError());
Expand Down Expand Up @@ -89,7 +88,7 @@ exports.docs = series(parallel(cleanDocs, lintSrc), async () => {
/*
* test tasks
*/
async function runTests(cover) {
function runTests(cover) {
const args = [];
let { execPath } = process;

Expand Down Expand Up @@ -184,7 +183,9 @@ function resolveModule(name) {
}
}

exports.test = series(parallel(lintTest, build), function test() { return runTests(); });
exports['test-only'] = series(lintTest, function test() { return runTests(); });
exports.coverage = series(parallel(cleanCoverage, lintTest, build), function test() { return runTests(true); });
exports['coverage-only'] = series(parallel(cleanCoverage, lintTest), function test() { return runTests(true); });
exports.test = series(lintTest, build, async function test() { return runTests(); });
exports['test-only'] = series(lintTest, async function test() { return runTests(); });
exports.coverage = series(cleanCoverage, lintTest, build, async function test() { return runTests(true); });
exports['coverage-only'] = series(cleanCoverage, lintTest, async function test() { return runTests(true); });

process.on('uncaughtException', () => {});
26 changes: 13 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gawk",
"version": "4.6.4",
"version": "4.6.5",
"description": "Observable JavaScript object model",
"main": "./dist/index.js",
"author": "Chris Barber <[email protected]> (https://github.com/cb1kenobi)",
Expand All @@ -24,24 +24,24 @@
},
"dependencies": {
"fast-deep-equal": "^2.0.1",
"source-map-support": "^0.5.12"
"source-map-support": "^0.5.16"
},
"devDependencies": {
"@babel/core": "^7.5.0",
"@babel/plugin-transform-modules-commonjs": "^7.5.0",
"@babel/register": "^7.4.4",
"@babel/core": "^7.6.4",
"@babel/plugin-transform-modules-commonjs": "^7.6.0",
"@babel/register": "^7.6.2",
"ansi-colors": "^4.1.1",
"babel-eslint": "^10.0.2",
"babel-eslint": "^10.0.3",
"babel-loader": "^8.0.6",
"babel-plugin-istanbul": "^5.1.4",
"babel-plugin-istanbul": "^5.2.0",
"chai": "^4.2.0",
"coveralls": "^3.0.4",
"coveralls": "^3.0.7",
"esdoc": "^1.1.0",
"esdoc-ecmascript-proposal-plugin": "^1.0.0",
"esdoc-standard-plugin": "^1.0.0",
"eslint": "^6.0.1",
"eslint": "^6.6.0",
"eslint-plugin-chai-expect": "^2.0.1",
"eslint-plugin-mocha": "^5.3.0",
"eslint-plugin-mocha": "^6.2.1",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-security": "^1.4.0",
"fancy-log": "^1.3.3",
Expand All @@ -50,12 +50,12 @@
"gulp-babel": "^8.0.0",
"gulp-debug": "^4.0.0",
"gulp-eslint": "^6.0.0",
"gulp-load-plugins": "^2.0.0",
"gulp-load-plugins": "^2.0.1",
"gulp-plumber": "^1.2.1",
"gulp-sourcemaps": "^2.6.5",
"mocha": "^6.1.4",
"mocha": "^6.2.2",
"nyc": "^14.1.1",
"sinon": "^7.3.2",
"sinon": "^7.5.0",
"sinon-chai": "^3.3.0"
},
"homepage": "https://github.com/cb1kenobi/gawk",
Expand Down
32 changes: 32 additions & 0 deletions test/test-object.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,17 @@ describe('set property', () => {

expect(gobj).to.deep.equal({ foo: 'bar' });
});

it('should set a symbol property', () => {
const id = Symbol();

const gobj = gawk({});
gobj[id] = 'foo';
expect(gobj).to.deep.equal({ [id]: 'foo' });

gobj[id] = 'bar';
expect(gobj).to.deep.equal({ [id]: 'bar' });
});
});

describe('delete property', () => {
Expand Down Expand Up @@ -284,6 +295,17 @@ describe('Object.keys()', () => {
});
});

describe('Object.getOwnPropertySymbols()', () => {
it('should return an array of symbol keys in the object', () => {
const id = Symbol();

const gobj = gawk({ [id]: 'foo' });
expect(gobj).to.deep.equal({ [id]: 'foo' });

expect(Object.getOwnPropertySymbols(gobj)).to.deep.equal([ id ]);
});
});

describe('JSON.stringify()', () => {
it('should stringify a gawked object', () => {
expect(JSON.stringify(gawk({ foo: 'bar' }))).to.equal('{"foo":"bar"}');
Expand Down Expand Up @@ -370,6 +392,16 @@ describe('gawk.merge()', () => {
expect(isGawked(gobj.foo)).to.be.true;
expect(gobj.foo.__gawk__.parents.has(gobj)).to.be.true;
});

it('should merge an object with a symbol property', () => {
const id = Symbol();

const gobj = gawk({ [id]: 'foo' });
expect(gobj).to.deep.equal({ [id]: 'foo' });

gawk.merge(gobj, { [id]: 'bar' });
expect(gobj).to.deep.equal({ [id]: 'bar' });
});
});

describe('gawk.mergeDeep()', () => {
Expand Down
10 changes: 10 additions & 0 deletions test/test-set.js
Original file line number Diff line number Diff line change
Expand Up @@ -390,4 +390,14 @@ describe('gawk.set()', () => {
]);
expect(counter).to.equal(2);
});

it('should set an object with a symbol property', () => {
const id = Symbol();

const gobj = gawk({ [id]: 'foo' });
expect(gobj).to.deep.equal({ [id]: 'foo' });

gawk.set(gobj, { [id]: 'bar' });
expect(gobj).to.deep.equal({ [id]: 'bar' });
});
});
Loading

0 comments on commit fbfa69f

Please sign in to comment.