feat(queries/getAutomatischInfo): add mation
This commit is contained in:
@@ -49,6 +49,7 @@ type AppConfig = {
|
|||||||
smtpPassword: string;
|
smtpPassword: string;
|
||||||
fromEmail: string;
|
fromEmail: string;
|
||||||
isCloud: boolean;
|
isCloud: boolean;
|
||||||
|
isMation: boolean;
|
||||||
isSelfHosted: boolean;
|
isSelfHosted: boolean;
|
||||||
paddleVendorId: number;
|
paddleVendorId: number;
|
||||||
paddleVendorAuthCode: string;
|
paddleVendorAuthCode: string;
|
||||||
@@ -127,6 +128,7 @@ const appConfig: AppConfig = {
|
|||||||
fromEmail: process.env.FROM_EMAIL,
|
fromEmail: process.env.FROM_EMAIL,
|
||||||
isCloud: process.env.AUTOMATISCH_CLOUD === 'true',
|
isCloud: process.env.AUTOMATISCH_CLOUD === 'true',
|
||||||
isSelfHosted: process.env.AUTOMATISCH_CLOUD !== 'true',
|
isSelfHosted: process.env.AUTOMATISCH_CLOUD !== 'true',
|
||||||
|
isMation: process.env.MATION === 'true',
|
||||||
paddleVendorId: Number(process.env.PADDLE_VENDOR_ID),
|
paddleVendorId: Number(process.env.PADDLE_VENDOR_ID),
|
||||||
paddleVendorAuthCode: process.env.PADDLE_VENDOR_AUTH_CODE,
|
paddleVendorAuthCode: process.env.PADDLE_VENDOR_AUTH_CODE,
|
||||||
paddlePublicKey: process.env.PADDLE_PUBLIC_KEY,
|
paddlePublicKey: process.env.PADDLE_PUBLIC_KEY,
|
||||||
|
@@ -9,6 +9,7 @@ describe('graphQL getAutomatischInfo query', () => {
|
|||||||
query {
|
query {
|
||||||
getAutomatischInfo {
|
getAutomatischInfo {
|
||||||
isCloud
|
isCloud
|
||||||
|
isMation
|
||||||
license {
|
license {
|
||||||
id
|
id
|
||||||
name
|
name
|
||||||
@@ -24,6 +25,7 @@ describe('graphQL getAutomatischInfo query', () => {
|
|||||||
jest.spyOn(license, 'getLicense').mockResolvedValue(false);
|
jest.spyOn(license, 'getLicense').mockResolvedValue(false);
|
||||||
|
|
||||||
jest.replaceProperty(appConfig, 'isCloud', false);
|
jest.replaceProperty(appConfig, 'isCloud', false);
|
||||||
|
jest.replaceProperty(appConfig, 'isMation', false);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return empty license data', async () => {
|
it('should return empty license data', async () => {
|
||||||
@@ -36,6 +38,7 @@ describe('graphQL getAutomatischInfo query', () => {
|
|||||||
data: {
|
data: {
|
||||||
getAutomatischInfo: {
|
getAutomatischInfo: {
|
||||||
isCloud: false,
|
isCloud: false,
|
||||||
|
isMation: false,
|
||||||
license: {
|
license: {
|
||||||
id: null,
|
id: null,
|
||||||
name: null,
|
name: null,
|
||||||
@@ -77,6 +80,7 @@ describe('graphQL getAutomatischInfo query', () => {
|
|||||||
data: {
|
data: {
|
||||||
getAutomatischInfo: {
|
getAutomatischInfo: {
|
||||||
isCloud: true,
|
isCloud: true,
|
||||||
|
isMation: false,
|
||||||
license: {
|
license: {
|
||||||
expireAt: '2025-08-09T10:56:54.144Z',
|
expireAt: '2025-08-09T10:56:54.144Z',
|
||||||
id: '123123',
|
id: '123123',
|
||||||
@@ -105,6 +109,69 @@ describe('graphQL getAutomatischInfo query', () => {
|
|||||||
const expectedResponsePayload = {
|
const expectedResponsePayload = {
|
||||||
data: {
|
data: {
|
||||||
getAutomatischInfo: {
|
getAutomatischInfo: {
|
||||||
|
isCloud: false,
|
||||||
|
isMation: false,
|
||||||
|
license: {
|
||||||
|
expireAt: '2025-08-09T10:56:54.144Z',
|
||||||
|
id: '123123',
|
||||||
|
name: 'Test License',
|
||||||
|
verified: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
expect(response.body).toEqual(expectedResponsePayload);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('and with mation flag enabled', () => {
|
||||||
|
beforeEach(async () => {
|
||||||
|
jest.replaceProperty(appConfig, 'isCloud', false);
|
||||||
|
jest.replaceProperty(appConfig, 'isMation', true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return all license data', async () => {
|
||||||
|
const response = await request(app)
|
||||||
|
.post('/graphql')
|
||||||
|
.send({ query })
|
||||||
|
.expect(200);
|
||||||
|
|
||||||
|
const expectedResponsePayload = {
|
||||||
|
data: {
|
||||||
|
getAutomatischInfo: {
|
||||||
|
isCloud: false,
|
||||||
|
isMation: true,
|
||||||
|
license: {
|
||||||
|
expireAt: '2025-08-09T10:56:54.144Z',
|
||||||
|
id: '123123',
|
||||||
|
name: 'Test License',
|
||||||
|
verified: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
expect(response.body).toEqual(expectedResponsePayload);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('and with mation flag disabled', () => {
|
||||||
|
beforeEach(async () => {
|
||||||
|
jest.replaceProperty(appConfig, 'isCloud', false);
|
||||||
|
jest.replaceProperty(appConfig, 'isMation', false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return all license data', async () => {
|
||||||
|
const response = await request(app)
|
||||||
|
.post('/graphql')
|
||||||
|
.send({ query })
|
||||||
|
.expect(200);
|
||||||
|
|
||||||
|
const expectedResponsePayload = {
|
||||||
|
data: {
|
||||||
|
getAutomatischInfo: {
|
||||||
|
isMation: false,
|
||||||
isCloud: false,
|
isCloud: false,
|
||||||
license: {
|
license: {
|
||||||
expireAt: '2025-08-09T10:56:54.144Z',
|
expireAt: '2025-08-09T10:56:54.144Z',
|
||||||
|
@@ -13,6 +13,7 @@ const getAutomatischInfo = async () => {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
isCloud: appConfig.isCloud,
|
isCloud: appConfig.isCloud,
|
||||||
|
isMation: appConfig.isMation,
|
||||||
license: computedLicense,
|
license: computedLicense,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@@ -646,6 +646,7 @@ type AppHealth {
|
|||||||
|
|
||||||
type GetAutomatischInfo {
|
type GetAutomatischInfo {
|
||||||
isCloud: Boolean
|
isCloud: Boolean
|
||||||
|
isMation: Boolean
|
||||||
license: License
|
license: License
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -4,6 +4,7 @@ export const GET_AUTOMATISCH_INFO = gql`
|
|||||||
query GetAutomatischInfo {
|
query GetAutomatischInfo {
|
||||||
getAutomatischInfo {
|
getAutomatischInfo {
|
||||||
isCloud
|
isCloud
|
||||||
|
isMation
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
Reference in New Issue
Block a user