Skip to content

Commit

Permalink
test(fixtures): update fixtures
Browse files Browse the repository at this point in the history
Fix specs for

- crc-model
- crc-responsibility

#44,#187
  • Loading branch information
gregswindle committed Feb 18, 2018
1 parent f92cc65 commit 9f6fb0b
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 19 deletions.
20 changes: 11 additions & 9 deletions tests/fixtures/crc/crc-responsibilities/point.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/**
* @class Point
* @description Represents a point.
* @class Point - Represents a point.
*/

class Point {
Expand All @@ -18,9 +17,10 @@ class Point {
}

/**
* @method - Get the x value.
* @method getX - Get the x value.
*
* @return {number} The x value.
* @memberOf Point.prototype
*/

getX () {
Expand All @@ -29,9 +29,11 @@ class Point {
}

/**
* @function - Get the y value.
* @description Get the y value.
*
* @function getY
* @return {number} The y value.
* @memberOf Point.prototype
*/

getY () {
Expand All @@ -40,16 +42,16 @@ class Point {
}

/**
* @static
*
* @description Convert a string containing two comma-separated numbers into a point.
* @description Convert a string containing two comma-separated numbers into a point.
*
* @static
* @method fromString
* @param {string} str - The string containing two comma-separated numbers.
* @return {Point} A Point object.
* @returns {Point} A Point object.
* @memberof Point
*/

static fromString (str) {
static fromString (str) {
const [
x,
y
Expand Down
18 changes: 8 additions & 10 deletions tests/lib/crc/crc-model.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ describe("eslint-plugin-crc/crc/crc-model", () => {
let crcClass = null;
let crcMath = null;
let crcModel = null;
const responsibilities = [
"A",
"B",
"C"
];
const responsibilities = {
"comments": [],
"descriptions": ["A", "B", "C"],
"primary": "A"
};

const nullCrcModelObject = {
"class": new CrcClass(),
Expand All @@ -33,11 +33,9 @@ describe("eslint-plugin-crc/crc/crc-model", () => {
"responsibilities": []
};

describe("represents a Represents a Class-Responsibility-Collaboration model, which expresses a class's", () => {
describe("represents a Class-Responsibility-Collaboration model, which expresses a class's", () => {
beforeEach(() => {
sinon.stub(CrcResponsibility, "create").returns({
"all": responsibilities
});
sinon.stub(CrcResponsibility, "create").returns(responsibilities);

crcClass = new CrcClass({
"code": {
Expand Down Expand Up @@ -78,7 +76,7 @@ describe("eslint-plugin-crc/crc/crc-model", () => {
});

specify("responsibilities", () => {
expect(crcModel.responsibilities.length).to.equal(3);
expect(crcModel.responsibilities.descriptions.length).to.equal(3);
});

specify("collaborators", () => {
Expand Down
11 changes: 11 additions & 0 deletions tests/lib/crc/crc-responsibility.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,15 @@ describe("CrcResponsibility", () => {
expect(crcClass.meta.description).to.equal(expectedDesc);
});
});

describe("returns all non-empty descriptions as responsbilities", () => {
specify("all responsibilities", () => {
const context = CrcContext.parse({
"filePath": "tests/fixtures/crc/crc-responsibilities/point.js"
});
const crcClass = CrcClass.create(context);
const r = new CrcResponsibility(crcClass);
console.log(r.valueOf());
});
});
});

0 comments on commit 9f6fb0b

Please sign in to comment.