mirror of
https://github.com/graycoreio/github-actions-magento2.git
synced 2026-06-13 13:14:53 +00:00
feat: add project versions (#110)
* refactor: allow version matrixes by projects * feat: add initial version-matrix for mage-os * feat: add project as optional input to action * docs: document new input * refactor: tighten types a bit * chore: apply change requests from code review
This commit is contained in:
@@ -1,49 +1,96 @@
|
||||
import { getMatrixForKind } from "./get-matrix-for-kind";
|
||||
|
||||
describe('getMatrixForKind', () => {
|
||||
|
||||
describe('getMatrixForKind for mage-os', () => {
|
||||
const project = "mage-os";
|
||||
|
||||
it('returns a matrix for `latest`', () => {
|
||||
const result = getMatrixForKind("latest");
|
||||
const result = getMatrixForKind("latest", project);
|
||||
|
||||
expect(result.magento).toBeDefined();
|
||||
expect(result.include).toBeDefined();
|
||||
});
|
||||
|
||||
it('returns a matrix for `currently-supported`', () => {
|
||||
const result = getMatrixForKind("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");
|
||||
const result = getMatrixForKind("all", project);
|
||||
|
||||
expect(result.magento).toBeDefined();
|
||||
expect(result.include).toBeDefined();
|
||||
});
|
||||
|
||||
it('returns a matrix for valid `custom`', () => {
|
||||
const result = getMatrixForKind("custom", "magento/project-community-edition:2.3.7-p3");
|
||||
const result = getMatrixForKind("custom", project, "mage-os/project-community-edition:1.0.0");
|
||||
|
||||
expect(result.magento).toBeDefined();
|
||||
expect(result.include).toBeDefined();
|
||||
});
|
||||
|
||||
it('returns a matrix for the next release when using `nightly`', () => {
|
||||
const result = getMatrixForKind("nightly", "magento/project-community-edition:next");
|
||||
const result = getMatrixForKind("nightly", project, "mage-os/project-community-edition:next");
|
||||
|
||||
expect(result.magento).toBeDefined();
|
||||
expect(result.include).toBeDefined();
|
||||
});
|
||||
|
||||
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 for `latest`', () => {
|
||||
const result = getMatrixForKind("latest", project);
|
||||
|
||||
expect(result.magento).toBeDefined();
|
||||
expect(result.include).toBeDefined();
|
||||
});
|
||||
|
||||
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.3.7-p3");
|
||||
|
||||
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 matrix for valid multiple `custom`', () => {
|
||||
const result = getMatrixForKind("custom", "magento/project-community-edition:2.3.7-p3,magento/project-community-edition:2.4.0");
|
||||
const result = getMatrixForKind("custom", project, "magento/project-community-edition:2.3.7-p3,magento/project-community-edition:2.4.0");
|
||||
|
||||
expect(result.magento).toBeDefined();
|
||||
expect(result.include).toBeDefined();
|
||||
});
|
||||
|
||||
it('errors for invalid `custom``', () => {
|
||||
expect(() => getMatrixForKind("custom")).toThrowError();
|
||||
expect(() => getMatrixForKind("custom", project)).toThrowError();
|
||||
});
|
||||
})
|
||||
Reference in New Issue
Block a user