Skip to content

Commit df57f4f

Browse files
committed
wip(runkit): define the predicate
1 parent 5202003 commit df57f4f

4 files changed

Lines changed: 21 additions & 1 deletion

File tree

src/project-type/lifter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ function vcsRepositoryHostedOnGithub(vcs) {
77
return vcs && 'github' === vcs.host;
88
}
99

10-
export default async function ({projectRoot, packageDetails, vcs}) {
10+
export default async function liftProjectType({projectRoot, packageDetails, vcs}) {
1111
if (await isPackage({projectRoot, packageDetails})) return liftPackage({projectRoot, packageDetails});
1212
if (await isCli({projectRoot, packageDetails})) return liftCli({projectRoot, packageDetails});
1313

src/runkit/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
export {default as scaffold} from './scaffolder.js';
22
export {default as remove} from './remover.js';
3+
export {default as test} from './tester.js';

src/runkit/tester.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export default function runkitIsConfigured({packageDetails}) {
2+
return !!packageDetails.runkitExampleFilename;
3+
}

src/runkit/tester.test.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import {describe, expect, it} from 'vitest';
2+
import any from '@travi/any';
3+
4+
import runkitIsConfigured from './tester.js';
5+
6+
describe('runkit predicate', () => {
7+
it('should return `true` if the `runkitExampleFilename` property exists in the `package.json`', async () => {
8+
expect(
9+
await runkitIsConfigured({packageDetails: {...any.simpleObject(), runkitExampleFilename: any.word()}})
10+
).toBe(true);
11+
});
12+
13+
it('should return `false` if the `runkitExampleFilename` property does not exist in the `package.json`', async () => {
14+
expect(await runkitIsConfigured({packageDetails: any.simpleObject()})).toBe(false);
15+
});
16+
});

0 commit comments

Comments
 (0)