@flipdish/authorization 0.0.6-rc.1766078139 → 0.0.6-rc.1766139173

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -70,13 +70,15 @@ describe("Authorization Tests", () => {
70
70
  });
71
71
 
72
72
  test("List Feature Based Roles", async () => {
73
- const featureBasedRolesResponse = await configurationData.listFeatureBasedRoles();
73
+ const featureBasedRolesResponse =
74
+ await configurationData.listFeatureBasedRoles();
74
75
  expect(featureBasedRolesResponse.status).toBe(200);
75
76
  expect(featureBasedRolesResponse.data.roles).toBeDefined();
76
77
  expect(featureBasedRolesResponse.data.roles.length).toBeGreaterThan(0);
77
- expect(featureBasedRolesResponse.data.roles).toContainEqual(
78
- { name: "OrgViewer", permissions: ["ViewOrg"] }
79
- );
78
+ expect(featureBasedRolesResponse.data.roles).toContainEqual({
79
+ name: "OrgViewer",
80
+ permissions: ["ViewOrg"],
81
+ });
80
82
  });
81
83
 
82
84
  test("List named roles", async () => {
@@ -205,29 +207,32 @@ describe("Authorization Tests", () => {
205
207
  });
206
208
 
207
209
  it("should authenticate and check if a user is in a role with a valid FD-Authorization cookie", async () => {
208
- const isInRoleResponse = await authorization.authenticateAndCheckIsInRole({
209
- headers: {
210
- Cookie: `FD-Authorization=${process.env.FD_AUTH_COOKIE_PROD};`,
211
- },
212
- roles: ["Admin"],
213
- });
210
+ const isInRoleResponse =
211
+ await authorization.authenticateAndCheckIsInRole({
212
+ headers: {
213
+ Cookie: `FD-Authorization=${process.env.FD_AUTH_COOKIE_PROD};`,
214
+ },
215
+ roles: ["Admin"],
216
+ });
214
217
  expect(isInRoleResponse.status).toBe(200);
215
- expect(isInRoleResponse.data.authorized).toBe(false);
218
+ expect(isInRoleResponse.data.authorized).toBe(true);
216
219
  });
217
220
 
218
221
  it("should authenticate and check if a user is in a role with a valid Bearer token", async () => {
219
- const isInRoleResponse = await authorization.authenticateAndCheckIsInRole({
220
- headers: {
221
- Authorization: `Bearer ${process.env.FLIPDISH_BEARER_TOKEN_PROD}`,
222
- },
223
- roles: ["Admin"],
224
- });
222
+ const isInRoleResponse =
223
+ await authorization.authenticateAndCheckIsInRole({
224
+ headers: {
225
+ Authorization: `Bearer ${process.env.FLIPDISH_BEARER_TOKEN_PROD}`,
226
+ },
227
+ roles: ["Admin"],
228
+ });
225
229
  expect(isInRoleResponse.status).toBe(200);
226
- expect(isInRoleResponse.data.authorized).toBe(false);
230
+ expect(isInRoleResponse.data.authorized).toBe(true);
227
231
  });
228
232
  });
229
233
  });
230
234
  });
235
+
231
236
  ```
232
237
 
233
238
  The generated Node module can be used in the following environments: