Skip to content
This repository was archived by the owner on Mar 28, 2022. It is now read-only.

Commit 0f016b2

Browse files
committed
Modify tests for new id property
1 parent 1b0ed51 commit 0f016b2

2 files changed

Lines changed: 23 additions & 9 deletions

File tree

test/acceptance/behaviors-api.spec.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ describe("behaviors api", () => {
2727
{
2828
extendedFrom: null,
2929
fixtures: ["12e5f429b92f67d4ec2bf90940ec1135", "0dbc954f9d9c9f3f7996c60e63384c9e"],
30-
name: "standard"
30+
name: "standard",
31+
id: "standard"
3132
},
3233
{
3334
extendedFrom: "standard",
@@ -36,7 +37,8 @@ describe("behaviors api", () => {
3637
"12e5f429b92f67d4ec2bf90940ec1135",
3738
"0dbc954f9d9c9f3f7996c60e63384c9e"
3839
],
39-
name: "user2"
40+
name: "user2",
41+
id: "user2"
4042
},
4143
{
4244
extendedFrom: "standard",
@@ -45,7 +47,8 @@ describe("behaviors api", () => {
4547
"12e5f429b92f67d4ec2bf90940ec1135",
4648
"0dbc954f9d9c9f3f7996c60e63384c9e"
4749
],
48-
name: "dynamic"
50+
name: "dynamic",
51+
id: "dynamic"
4952
}
5053
]);
5154
});
@@ -57,7 +60,8 @@ describe("behaviors api", () => {
5760
expect(response).toEqual({
5861
extendedFrom: null,
5962
fixtures: ["12e5f429b92f67d4ec2bf90940ec1135", "0dbc954f9d9c9f3f7996c60e63384c9e"],
60-
name: "standard"
63+
name: "standard",
64+
id: "standard"
6165
});
6266
});
6367
});
@@ -72,7 +76,8 @@ describe("behaviors api", () => {
7276
"12e5f429b92f67d4ec2bf90940ec1135",
7377
"0dbc954f9d9c9f3f7996c60e63384c9e"
7478
],
75-
name: "dynamic"
79+
name: "dynamic",
80+
id: "dynamic"
7681
});
7782
});
7883
});
@@ -84,7 +89,7 @@ describe("behaviors api", () => {
8489
simple: false
8590
});
8691
expect(response.statusCode).toEqual(404);
87-
expect(response.body.message).toEqual('Behavior with name "foo" was not found');
92+
expect(response.body.message).toEqual('Behavior with id "foo" was not found');
8893
});
8994
});
9095
});

test/unit/src/Behaviors.spec.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ describe("Behavior", () => {
5555
});
5656

5757
it("should register a get router for behavior names", async () => {
58-
expect(libMocks.stubs.express.get.getCall(1).args[0]).toEqual("/:name");
58+
expect(libMocks.stubs.express.get.getCall(1).args[0]).toEqual("/:id");
5959
});
6060
});
6161

@@ -64,11 +64,13 @@ describe("Behavior", () => {
6464
coreInstance.behaviors = {
6565
collection: [
6666
{
67+
id: "foo",
6768
name: "foo",
6869
fixtures: [{ id: "foo-fixture-id-1" }, { id: "foo-fixture-id-2" }],
6970
extendedFrom: "foo-base-behavior"
7071
},
7172
{
73+
id: "foo2",
7274
name: "foo2",
7375
fixtures: [{ id: "foo-fixture-id-3" }],
7476
extendedFrom: null
@@ -79,11 +81,13 @@ describe("Behavior", () => {
7981
behaviors.getCollection({}, resMock);
8082
expect(resMock.send.getCall(0).args[0]).toEqual([
8183
{
84+
id: "foo",
8285
name: "foo",
8386
fixtures: ["foo-fixture-id-1", "foo-fixture-id-2"],
8487
extendedFrom: "foo-base-behavior"
8588
},
8689
{
90+
id: "foo2",
8791
name: "foo2",
8892
fixtures: ["foo-fixture-id-3"],
8993
extendedFrom: null
@@ -97,11 +101,13 @@ describe("Behavior", () => {
97101
coreInstance.behaviors = {
98102
collection: [
99103
{
104+
id: "foo",
100105
name: "foo",
101106
fixtures: [{ id: "foo-fixture-id-1" }, { id: "foo-fixture-id-2" }],
102107
extendedFrom: "foo-base-behavior"
103108
},
104109
{
110+
id: "foo2",
105111
name: "foo2",
106112
fixtures: [{ id: "foo-fixture-id-3" }],
107113
extendedFrom: null
@@ -112,12 +118,13 @@ describe("Behavior", () => {
112118
behaviors.getModel(
113119
{
114120
params: {
115-
name: "foo"
121+
id: "foo"
116122
}
117123
},
118124
resMock
119125
);
120126
expect(resMock.send.getCall(0).args[0]).toEqual({
127+
id: "foo",
121128
name: "foo",
122129
fixtures: ["foo-fixture-id-1", "foo-fixture-id-2"],
123130
extendedFrom: "foo-base-behavior"
@@ -130,11 +137,13 @@ describe("Behavior", () => {
130137
coreInstance.behaviors = {
131138
collection: [
132139
{
140+
id: "foo",
133141
name: "foo",
134142
fixtures: [{ id: "foo-fixture-id-1" }, { id: "foo-fixture-id-2" }],
135143
extendedFrom: "foo-base-behavior"
136144
},
137145
{
146+
id: "foo2",
138147
name: "foo2",
139148
fixtures: [{ id: "foo-fixture-id-3" }],
140149
extendedFrom: null
@@ -145,7 +154,7 @@ describe("Behavior", () => {
145154
behaviors.getModel(
146155
{
147156
params: {
148-
name: "foo3"
157+
id: "foo3"
149158
}
150159
},
151160
resMock,

0 commit comments

Comments
 (0)