mirror of
https://github.com/graycoreio/github-actions-magento2.git
synced 2026-06-13 13:14:53 +00:00
138 lines
5.0 KiB
TypeScript
138 lines
5.0 KiB
TypeScript
import { getMatrixForKind } from "./get-matrix-for-kind";
|
|
|
|
|
|
describe('getMatrixForKind for mage-os', () => {
|
|
const project = "mage-os";
|
|
|
|
it('returns a matrix for `latest`', () => {
|
|
const result = getMatrixForKind("latest", project);
|
|
|
|
expect(result.magento).toBeDefined();
|
|
expect(result.include).toBeDefined();
|
|
});
|
|
|
|
it('returns a single-element matrix for with a matrix "magento" for `latest`', () => {
|
|
const result = getMatrixForKind("latest", project);
|
|
expect(result.magento.length).toEqual(1);
|
|
expect(result.include.length).toEqual(1);
|
|
expect(result.magento[0]).toEqual(result.include[0].magento);
|
|
});
|
|
|
|
it('returns a matrix for `currently-supported`', () => {
|
|
const result = getMatrixForKind("currently-supported", project);
|
|
|
|
expect(result.magento).toBeDefined();
|
|
expect(result.include).toBeDefined();
|
|
});
|
|
|
|
it('returns a matrix for `all`', () => {
|
|
const result = getMatrixForKind("all", project);
|
|
|
|
expect(result.magento).toBeDefined();
|
|
expect(result.include).toBeDefined();
|
|
});
|
|
|
|
it('returns a matrix for valid `custom`', () => {
|
|
const result = getMatrixForKind("custom", project, "mage-os/project-community-edition:1.0.0");
|
|
|
|
expect(result.magento).toBeDefined();
|
|
expect(result.include).toBeDefined();
|
|
expect(result.magento[0]).toBe('mage-os/project-community-edition:1.0.0');
|
|
});
|
|
|
|
it('returns a matrix nightly`', () => {
|
|
const result = getMatrixForKind("nightly", project);
|
|
expect(result.magento).toBeDefined();
|
|
expect(result.include).toBeDefined();
|
|
expect(result.magento[0]).toBe('mage-os/project-community-edition:@alpha');
|
|
});
|
|
|
|
it('returns a matrix for the next release when using `nightly`', () => {
|
|
const result = getMatrixForKind("nightly", project, "mage-os/project-community-edition:next");
|
|
|
|
expect(result.magento).toBeDefined();
|
|
expect(result.include).toBeDefined();
|
|
});
|
|
|
|
it('returns a single-element matrix for with a matrix "magento" for `nightly`', () => {
|
|
const result = getMatrixForKind("nightly", project);
|
|
expect(result.magento.length).toEqual(1);
|
|
expect(result.include.length).toEqual(1);
|
|
expect(result.magento[0]).toEqual(result.include[0].magento);
|
|
});
|
|
|
|
it('errors for invalid `custom``', () => {
|
|
expect(() => getMatrixForKind("custom", project)).toThrowError();
|
|
});
|
|
})
|
|
|
|
|
|
describe('getMatrixForKind for magento-open-source', () => {
|
|
const project = "magento-open-source";
|
|
|
|
it('returns a matrix nightly`', () => {
|
|
const result = getMatrixForKind("nightly", project);
|
|
expect(result.magento).toBeDefined();
|
|
expect(result.include).toBeDefined();
|
|
});
|
|
|
|
it('returns a matrix for `latest`', () => {
|
|
const result = getMatrixForKind("latest", project);
|
|
console.log(result);
|
|
expect(result.magento).toBeDefined();
|
|
expect(result.include).toBeDefined();
|
|
});
|
|
|
|
it('returns a single-element matrix for with a matrix "magento" for `latest`', () => {
|
|
const result = getMatrixForKind("latest", project);
|
|
expect(result.magento.length).toEqual(1);
|
|
expect(result.include.length).toEqual(1);
|
|
expect(result.magento[0]).toEqual(result.include[0].magento);
|
|
});
|
|
|
|
it('returns a matrix for `currently-supported`', () => {
|
|
const result = getMatrixForKind("currently-supported", project);
|
|
|
|
expect(result.magento).toBeDefined();
|
|
expect(result.include).toBeDefined();
|
|
});
|
|
|
|
it('returns a matrix for `all`', () => {
|
|
const result = getMatrixForKind("all", project);
|
|
|
|
expect(result.magento).toBeDefined();
|
|
expect(result.include).toBeDefined();
|
|
});
|
|
|
|
it('returns a matrix for valid `custom`', () => {
|
|
const result = getMatrixForKind("custom", project, "magento/project-community-edition:2.4.2");
|
|
|
|
expect(result.magento).toBeDefined();
|
|
expect(result.include).toBeDefined();
|
|
});
|
|
|
|
it('returns a matrix for the next release when using `nightly`', () => {
|
|
const result = getMatrixForKind("nightly", project, "magento/project-community-edition:next");
|
|
|
|
expect(result.magento).toBeDefined();
|
|
expect(result.include).toBeDefined();
|
|
});
|
|
|
|
it('returns a single-element matrix for with a matrix "magento" for `nightly`', () => {
|
|
const result = getMatrixForKind("nightly", project);
|
|
expect(result.magento.length).toEqual(1);
|
|
expect(result.include.length).toEqual(1);
|
|
expect(result.magento[0]).toEqual(result.include[0].magento);
|
|
});
|
|
|
|
it('returns a matrix for valid multiple `custom`', () => {
|
|
const result = getMatrixForKind("custom", project, "magento/project-community-edition:2.4.2,magento/project-community-edition:2.4.3");
|
|
|
|
expect(result.magento).toBeDefined();
|
|
expect(result.include).toBeDefined();
|
|
});
|
|
|
|
it('errors for invalid `custom``', () => {
|
|
expect(() => getMatrixForKind("custom", project)).toThrowError();
|
|
});
|
|
}) |