feat(workspaces): add discount and total fields

This commit is contained in:
Alessandro Magionami
2024-08-29 15:20:51 +02:00
parent 62e0c9eeaf
commit ff29654b66
9 changed files with 109 additions and 9 deletions
@@ -47,6 +47,7 @@ import {
import { getBranchesByStreamId } from '@/modules/core/services/branches'
import { grantStreamPermissions } from '@/modules/core/repositories/streams'
import { getWorkspaceFactory } from '@/modules/workspaces/repositories/workspaces'
import { WorkspaceEarlyAdopterDiscount } from '@/modules/workspaces/domain/constants'
const createProjectWithVersions =
({ apollo }: { apollo: TestApolloServer }) =>
@@ -310,7 +311,8 @@ describe('Workspaces GQL CRUD', () => {
})
expect(res).to.not.haveGraphQLErrors()
const { subTotal, currency, items } = res.data!.workspace.billing.cost
const { subTotal, currency, items, total, discount } =
res.data!.workspace.billing.cost
expect(subTotal).to.equal(70 + 50 + 10)
expect(currency).to.equal('GBP')
expect(items).to.deep.equal([
@@ -335,6 +337,8 @@ describe('Workspaces GQL CRUD', () => {
cost: 0
}
])
expect(discount).to.deep.equal(WorkspaceEarlyAdopterDiscount)
expect(total).to.equal(65)
})
})