|
@@ -95,7 +95,7 @@ import { addPaymentToOrder, proceedToArrangingPayment } from './utils/test-order
|
|
|
describe('Promotions applied to Orders', () => {
|
|
describe('Promotions applied to Orders', () => {
|
|
|
const { server, adminClient, shopClient } = createTestEnvironment({
|
|
const { server, adminClient, shopClient } = createTestEnvironment({
|
|
|
...testConfig(),
|
|
...testConfig(),
|
|
|
- logger: new DefaultLogger({ level: LogLevel.Info }),
|
|
|
|
|
|
|
+ // logger: new DefaultLogger({ level: LogLevel.Info }),
|
|
|
paymentOptions: {
|
|
paymentOptions: {
|
|
|
paymentMethodHandlers: [testSuccessfulPaymentMethod],
|
|
paymentMethodHandlers: [testSuccessfulPaymentMethod],
|
|
|
},
|
|
},
|
|
@@ -203,6 +203,20 @@ describe('Promotions applied to Orders', () => {
|
|
|
expect(applyCouponCode.errorCode).toBe(ErrorCode.COUPON_CODE_EXPIRED_ERROR);
|
|
expect(applyCouponCode.errorCode).toBe(ErrorCode.COUPON_CODE_EXPIRED_ERROR);
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
+ it('coupon code application is case-sensitive', async () => {
|
|
|
|
|
+ const { applyCouponCode } = await shopClient.query<
|
|
|
|
|
+ ApplyCouponCode.Mutation,
|
|
|
|
|
+ ApplyCouponCode.Variables
|
|
|
|
|
+ >(APPLY_COUPON_CODE, {
|
|
|
|
|
+ couponCode: TEST_COUPON_CODE.toLowerCase(),
|
|
|
|
|
+ });
|
|
|
|
|
+ orderResultGuard.assertErrorResult(applyCouponCode);
|
|
|
|
|
+ expect(applyCouponCode.message).toBe(
|
|
|
|
|
+ `Coupon code "${TEST_COUPON_CODE.toLowerCase()}" is not valid`,
|
|
|
|
|
+ );
|
|
|
|
|
+ expect(applyCouponCode.errorCode).toBe(ErrorCode.COUPON_CODE_INVALID_ERROR);
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
it('applies a valid coupon code', async () => {
|
|
it('applies a valid coupon code', async () => {
|
|
|
const { applyCouponCode } = await shopClient.query<
|
|
const { applyCouponCode } = await shopClient.query<
|
|
|
ApplyCouponCode.Mutation,
|
|
ApplyCouponCode.Mutation,
|