Skip to content

Commit

Permalink
fix: unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Arun-KumarH committed Feb 13, 2024
1 parent 8b0db2f commit ad098f3
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 30 deletions.
4 changes: 3 additions & 1 deletion src/core/resource_adapters/gql.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ResourceAdapter, QueryResult } from './adapter.js';
import { ApolloClient } from 'apollo-client';
import pkg from 'apollo-client';
import gql from 'graphql-tag';
import { InMemoryCache } from 'apollo-cache-inmemory';
import { HttpLink } from 'apollo-link-http';
Expand All @@ -9,6 +9,8 @@ import { Request } from '@restorecommerce/rc-grpc-clients/dist/generated-server/
import * as errors from '../errors.js';
import fetch from 'cross-fetch';

const { ApolloClient } = pkg;

export class GraphQLAdapter implements ResourceAdapter {
constructor(private url: string, private logger: any, private clientOpts: any = {}) {
if (_.isEmpty(url) || _.isNil(url)) {
Expand Down
27 changes: 0 additions & 27 deletions test/access_control.json

This file was deleted.

2 changes: 1 addition & 1 deletion test/acl.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as mocha from 'mocha';
import * as should from 'should';
import { Worker } from '../lib/worker.js';
import { Worker } from '../src/worker';
import * as testUtils from './utils.js';
import * as yaml from 'js-yaml';
import * as fs from 'node:fs';
Expand Down
28 changes: 27 additions & 1 deletion test/core.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,33 @@ import { UserServiceDefinition } from '@restorecommerce/rc-grpc-clients/dist/gen
import { Request, Response, Response_Decision } from '@restorecommerce/rc-grpc-clients/dist/generated-server/io/restorecommerce/access_control.js';
import { cfg, logger } from './utils.js';

const acConfig = require('./access_control.json');
const acConfig = {
"combiningAlgorithms": [
{
"urn": "urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:deny-overrides",
"method": "denyOverrides"
},
{
"urn": "urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:permit-overrides",
"method": "permitOverrides"
},
{
"urn": "urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:first-applicable",
"method": "firstApplicable"
}
],
"urns": {
"roleScopingEntity": "urn:restorecommerce:acs:names:roleScopingEntity",
"roleScopingInstance": "urn:restorecommerce:acs:names:roleScopingInstance",
"hierarchicalRoleScoping": "urn:restorecommerce:acs:names:hierarchicalRoleScoping",
"ownerEntity": "urn:restorecommerce:acs:names:ownerIndicatoryEntity",
"ownerInstance": "urn:restorecommerce:acs:names:ownerInstance",
"resourceID": "urn:oasis:names:tc:xacml:1.0:resource:resource-id",
"entity": "urn:restorecommerce:acs:names:model:entity",
"role": "urn:restorecommerce:acs:names:role",
"operation": "urn:restorecommerce:acs:names:operation"
}
};

let ac: AccessController;
let request: Request;
Expand Down

0 comments on commit ad098f3

Please sign in to comment.