How to test for a propety of a class after promise resolution with mocha and chai
问题 I am trying out a bit of unit testing with Mocha + Chai as promised 'use strict'; var chai = require('chai').use(require('chai-as-promised')) var should = chai.should(); describe('Testing how promises work', () => { it("should work right", function(){ class SomeClass { constructor() { this.x = 0; } getSomething(inputVal) { let self = this; return new Promise((resolve, reject) => { setTimeout(function(){ if(inputVal){ self.x = 1; resolve(); } else{ self.x = -1; reject(); } }, 10); }); } } var