Skip to content

Commit 0ac40a4

Browse files
committed
Styling feedback
1 parent 7685be4 commit 0ac40a4

6 files changed

+27
-19
lines changed

src/constants.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
export const OR = "or";
22
export const AND = "and";
3-
export const NOT = "not";
3+
export const NOT = "not";

src/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
import Engine from './Engine';
1+
import Engine from "./Engine";
22

33
export default Engine;

test/Engine.invalid.test.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,7 @@ test("ignore empty rules with invalid schema", () => {
3838

3939
test("initialize with invalid rules", () => {
4040
expect(() => new Engine(invalidRules, schema)).toThrow();
41-
expect(testInProd(() => new Engine(invalidRules, schema))).not.toBeUndefined();
41+
expect(
42+
testInProd(() => new Engine(invalidRules, schema))
43+
).not.toBeUndefined();
4244
});

test/Engine.test.js

+2-6
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@ test("age greater 5", () => {
3535
});
3636

3737
test("age less 5", () => {
38-
return engine
39-
.run({ age: 4 })
40-
.then(actions => expect(actions).toEqual([]));
38+
return engine.run({ age: 4 }).then(actions => expect(actions).toEqual([]));
4139
});
4240

4341
test("age less 70 ", () => {
@@ -51,7 +49,5 @@ test("age less 70 ", () => {
5149
});
5250

5351
test("age greater 70 ", () => {
54-
return engine
55-
.run({ age: 71 })
56-
.then(actions => expect(actions).toEqual([]));
52+
return engine.run({ age: 71 }).then(actions => expect(actions).toEqual([]));
5753
});

test/applicableActions.multiField.test.js

+14-6
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,26 @@ const ACTION = {
77

88
const NO_ACTION = [];
99

10-
1110
test("OR works", () => {
1211
let orRules = [
1312
{
14-
conditions: { or: [{ firstName: "empty" }, { nickName: { is: "admin" } }] },
13+
conditions: {
14+
or: [{ firstName: "empty" }, { nickName: { is: "admin" } }],
15+
},
1516
event: ACTION,
1617
},
1718
];
1819

1920
expect(applicableActions(orRules, {})).toEqual([ACTION]);
20-
expect(applicableActions(orRules, { firstName: "Steve", nickName: "admin" })).toEqual([ACTION]);
21+
expect(
22+
applicableActions(orRules, { firstName: "Steve", nickName: "admin" })
23+
).toEqual([ACTION]);
2124
expect(applicableActions(orRules, { firstName: "some" })).toEqual(NO_ACTION);
22-
expect(applicableActions(orRules, { firstName: "Steve", nickName: "Wonder" })).toEqual(NO_ACTION);
25+
expect(
26+
applicableActions(orRules, { firstName: "Steve", nickName: "Wonder" })
27+
).toEqual(NO_ACTION);
2328
});
2429

25-
2630
test("AND works", () => {
2731
let andRules = [
2832
{
@@ -46,6 +50,10 @@ test("AND works", () => {
4650
applicableActions(andRules, { firstName: "Steve", nickName: "admin" })
4751
).toEqual(NO_ACTION);
4852
expect(
49-
applicableActions(andRules, { firstName: "Steve", nickName: "admin", age: 21 })
53+
applicableActions(andRules, {
54+
firstName: "Steve",
55+
nickName: "admin",
56+
age: 21,
57+
})
5058
).toEqual([ACTION]);
5159
});

test/conditionsMeet.test.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,13 @@ test("NOT condition", () => {
3535
let condition = {
3636
not: {
3737
firstName: {
38-
equal: "Will"
39-
}
40-
}
38+
equal: "Will",
39+
},
40+
},
4141
};
4242
expect(conditionsMeet(condition, { firstName: "Will" })).toBeFalsy();
4343
expect(conditionsMeet(condition, { firstName: "Smith" })).toBeTruthy();
44-
expect(conditionsMeet(condition, { firstName: "Will", lastName: "Smith" })).toBeFalsy();
44+
expect(
45+
conditionsMeet(condition, { firstName: "Will", lastName: "Smith" })
46+
).toBeFalsy();
4547
});

0 commit comments

Comments
 (0)