Skip to content

Commit

Permalink
fix: fix singleton specs
Browse files Browse the repository at this point in the history
  • Loading branch information
pviti committed Dec 18, 2024
1 parent e61b069 commit 2401996
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
8 changes: 6 additions & 2 deletions specs/resource.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ let clp: CommerceLayerProvisioningClient
let memberships: ListResponse<Membership>
let tempId: string

const organizationSlug = process.env.CL_SDK_ORGANIZATION


beforeAll(async () => {
clp = await getClient({})
Expand Down Expand Up @@ -61,14 +63,16 @@ describe('SDK:resource suite', () => {

it('resource.create', async () => {
const user_email = '[email protected]'
const org = (await clp.organizations.list()).first()
const params = organizationSlug ? { filters: { slug_eq: organizationSlug } } : undefined
const org = (await clp.organizations.list(params)).first()
console.log(org)
const role = (await clp.roles.list()).first()
if (!org || !role) throw new Error('Missing role or organization')
const ms = await clp.memberships.create({
user_email,
organization: clp.organizations.relationship(org),
role: clp.roles.relationship(role)
})
}).catch(err => { console.log(err); throw err })
expect(ms.id).not.toBeUndefined()
expect(ms.user_email).toEqual(user_email)
tempId = ms.id
Expand Down
1 change: 0 additions & 1 deletion specs/sdk.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ describe('SDK suite', () => {

it('response.emptyBody', async () => {


jest.setTimeout(15_000)

const cli = await getClient({})
Expand Down
1 change: 0 additions & 1 deletion test/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ const checkCommon = (request: RequestObj, path: string, id?: string, token?: str
}

const checkCommonData = (data: any, type: string, attributes: any, id?: string) => {
if (type === 'identity_providers') console.log(data)
if (id) expect(data.data.id).toBe(id)
expect(data.data.type).toBe(type)
const relationships: { [k: string]: any } = {}
Expand Down

0 comments on commit 2401996

Please sign in to comment.