|
| 1 | +import { describe, it, expect } from 'vitest'; |
| 2 | +import { readFileSync } from 'fs'; |
| 3 | +import { resolve } from 'path'; |
| 4 | +import { load } from 'js-yaml'; |
| 5 | + |
| 6 | +const root = resolve(__dirname, '../..'); |
| 7 | + |
| 8 | +function loadActionYml(path: string): any { |
| 9 | + return load(readFileSync(path, 'utf8')); |
| 10 | +} |
| 11 | + |
| 12 | +describe('root action.yml', () => { |
| 13 | + const rootAction = loadActionYml(resolve(root, 'action.yml')); |
| 14 | + const pkgAction = loadActionYml(resolve(root, 'packages/action/action.yml')); |
| 15 | + |
| 16 | + it('points main to packages/action/dist/index.js', () => { |
| 17 | + expect(rootAction.runs.main).toBe('packages/action/dist/index.js'); |
| 18 | + }); |
| 19 | + |
| 20 | + it('uses node20 runtime', () => { |
| 21 | + expect(rootAction.runs.using).toBe('node20'); |
| 22 | + }); |
| 23 | + |
| 24 | + it('has the same inputs as packages/action/action.yml', () => { |
| 25 | + expect(Object.keys(rootAction.inputs ?? {})).toEqual( |
| 26 | + Object.keys(pkgAction.inputs ?? {}) |
| 27 | + ); |
| 28 | + }); |
| 29 | + |
| 30 | + it('has the same outputs as packages/action/action.yml', () => { |
| 31 | + expect(Object.keys(rootAction.outputs ?? {})).toEqual( |
| 32 | + Object.keys(pkgAction.outputs ?? {}) |
| 33 | + ); |
| 34 | + }); |
| 35 | + |
| 36 | + it('packages/action/action.yml still uses relative dist path', () => { |
| 37 | + expect(pkgAction.runs.main).toBe('dist/index.js'); |
| 38 | + }); |
| 39 | +}); |
0 commit comments