Skip to content

Commit

Permalink
[Tests] use proper actual, expected ordering for non-confusing fail…
Browse files Browse the repository at this point in the history
…ure messages
  • Loading branch information
ljharb committed Sep 6, 2020
1 parent 805b86b commit 0065cb1
Show file tree
Hide file tree
Showing 9 changed files with 316 additions and 316 deletions.
14 changes: 7 additions & 7 deletions __tests__/src/elementType-test.js
Expand Up @@ -11,7 +11,7 @@ describe('elementType tests', () => {
const expected = 'function';
const actual = typeof elementType;

assert.equal(expected, actual);
assert.equal(actual, expected);
});

it('should throw an error if the argument is missing', () => {
Expand All @@ -29,7 +29,7 @@ describe('elementType tests', () => {
const expected = 'div';
const actual = elementType(node);

assert.equal(expected, actual);
assert.equal(actual, expected);
});

it('should return the correct type of the custom element given its node object', () => {
Expand All @@ -39,7 +39,7 @@ describe('elementType tests', () => {
const expected = 'Slider';
const actual = elementType(node);

assert.equal(expected, actual);
assert.equal(actual, expected);
});

it('should return the correct type of the custom object element given its node object', () => {
Expand All @@ -49,7 +49,7 @@ describe('elementType tests', () => {
const expected = 'UX.Slider';
const actual = elementType(node);

assert.equal(expected, actual);
assert.equal(actual, expected);
});

it('should return the correct type of the namespaced element given its node object', () => {
Expand All @@ -59,7 +59,7 @@ describe('elementType tests', () => {
const expected = 'UX:Slider';
const actual = elementType(node);

assert.equal(expected, actual);
assert.equal(actual, expected);
});

it('should return the correct type of the multiple custom object element given its node object',
Expand All @@ -70,7 +70,7 @@ describe('elementType tests', () => {
const expected = 'UX.Slider.Blue.Light';
const actual = elementType(node);

assert.equal(expected, actual);
assert.equal(actual, expected);
});

it('should return this.Component when given its node object', () => {
Expand All @@ -80,6 +80,6 @@ describe('elementType tests', () => {
const expected = 'this.Component';
const actual = elementType(node);

assert.equal(expected, actual);
assert.equal(actual, expected);
});
});
24 changes: 12 additions & 12 deletions __tests__/src/getProp-test.js
Expand Up @@ -11,14 +11,14 @@ describe('getProp', () => {
const expected = 'function';
const actual = typeof getProp;

assert.equal(expected, actual);
assert.equal(actual, expected);
});

it('should return undefined if no arguments are provided', () => {
const expected = undefined;
const actual = getProp();

assert.equal(expected, actual);
assert.equal(actual, expected);
});

it('should return undefined if the attribute is absent', () => {
Expand All @@ -30,7 +30,7 @@ describe('getProp', () => {
const expected = undefined;
const actual = getProp(props, prop);

assert.equal(expected, actual);
assert.equal(actual, expected);
});

it('should return the correct attribute if the attribute exists', () => {
Expand All @@ -42,7 +42,7 @@ describe('getProp', () => {
const expected = 'id';
const actual = getProp(props, prop).name.name;

assert.equal(expected, actual);
assert.equal(actual, expected);
});

it('should return the correct attribute if the attribute exists in spread', () => {
Expand All @@ -54,7 +54,7 @@ describe('getProp', () => {
const expected = 'id';
const actual = getProp(props, prop).name.name;

assert.equal(expected, actual);
assert.equal(actual, expected);
});

it('should return the correct attribute if the attribute exists in spread as an expression', () => {
Expand All @@ -68,8 +68,8 @@ describe('getProp', () => {
const actualName = actual.name.name;
const actualValue = actual.value.expression.name;

assert.equal(expected, actualName);
assert.equal(expected, actualValue);
assert.equal(actualName, expected);
assert.equal(actualValue, expected);
});

it('should return the correct attribute if the attribute exists in spread (case sensitive)', () => {
Expand All @@ -82,7 +82,7 @@ describe('getProp', () => {
const expected = 'id';
const actual = getProp(props, prop, options).name.name;

assert.equal(expected, actual);
assert.equal(actual, expected);
});

it('should return undefined if the attribute does not exist in spread (case sensitive)', () => {
Expand All @@ -95,7 +95,7 @@ describe('getProp', () => {
const expected = undefined;
const actual = getProp(props, prop, options);

assert.equal(expected, actual);
assert.equal(actual, expected);
});

it('should return undefined for key in spread', () => {
Expand All @@ -108,7 +108,7 @@ describe('getProp', () => {
const expected = undefined;
const actual = getProp(props, prop);

assert.equal(expected, actual);
assert.equal(actual, expected);
});

it('should return undefined if the attribute may exist in spread', () => {
Expand All @@ -120,7 +120,7 @@ describe('getProp', () => {
const expected = undefined;
const actual = getProp(props, prop);

assert.equal(expected, actual);
assert.equal(actual, expected);
});

it('should not crash if the spread contains a spread', () => {
Expand All @@ -144,6 +144,6 @@ describe('getProp', () => {
const expected = undefined;
const actual = getProp(props, prop, options);

assert.equal(expected, actual);
assert.equal(actual, expected);
});
});

0 comments on commit 0065cb1

Please sign in to comment.