Skip to content

Commit

Permalink
Added new tests
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianRappl committed Dec 15, 2023
1 parent b6bdd0e commit 7557f5c
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 5 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2019 - 2023 smapiot
Copyright (c) 2019 - 2024 smapiot

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,11 @@ If you don't specify the bundler name then the current working directory's *pack

- ✅ Scaffold pilet (using `sample-piral`)
- ✅ Run/debug new pilet
- ✅ Build v2 pilet
- ✅ Build v1 pilet
- ✅ Build v0 pilet
- ✅ Build `mf` pilet
- ✅ Build `v3` pilet
- ✅ Build `v2` pilet
- ✅ Build `v1` pilet
- ✅ Build `v0` pilet
- ✅ Build standalone pilet
- ✅ Build pilet manifest file
- ✅ Publish pilet (to temp. feed)
Expand Down Expand Up @@ -142,6 +144,8 @@ Available features:
- `pilet.v0`, supports the `v0` schema
- `pilet.v1`, supports the `v1` schema
- `pilet.v2`, supports the `v2` schema
- `pilet.v3`, supports the `v3` schema
- `pilet.mf`, supports the `mf` schema
- `importmap.ref`, supports usage of an importmap
- `importmap.local`, supports local creation of importmap side-bundles
- `build.pilet`, supports building a pilet
Expand Down
44 changes: 43 additions & 1 deletion src/pilet-build.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,52 @@ runTests('pilet-build', ({ test, setup }) => {
await ctx.run(`npm i [email protected]`);
});

test(
'from-sample-piral-directly-mf',
'can build a standard templated mf pilet from sample-piral',
['pilet.mf', 'build.pilet'],
async (ctx) => {
await ctx.run(`npx pilet build --schema mf`);

await ctx.assertFiles({
'dist/index.js'(content: string) {
expect(content).not.toBe('');
expect(content).not.toContain('//@pilet');
expect(content).not.toContain('System.register(');
expect(content).toMatch(/^var\s/);
expect(content).toContain('./pilet');
},
});
},
);

test(
'from-sample-piral-directly-v3',
'can build a standard templated v3 pilet from sample-piral',
['pilet.v3', 'build.pilet'],
async (ctx) => {
await ctx.run(`npx pilet build --schema v3`);

await ctx.assertFiles({
'dist/index.js'(content: string) {
expect(content).not.toBe('');
expect(content).toContain('//@pilet v:3');
expect(content).toContain('System.register(');
expect(content).not.toContain('currentScript.app=');
expect(content).not.toContain('require("react")');
expect(content).toContain('styles:');
expect(content).not.toContain('stylesheet');
},
});
},
);

test(
'from-sample-piral-directly-v2',
'can build a standard templated v2 pilet from sample-piral',
['pilet.v2', 'build.pilet'],
async (ctx) => {
await ctx.run(`npx pilet build`);
await ctx.run(`npx pilet build --schema v2`);

await ctx.assertFiles({
'dist/index.js'(content: string) {
Expand All @@ -21,6 +61,8 @@ runTests('pilet-build', ({ test, setup }) => {
expect(content).toContain('System.register(');
expect(content).not.toContain('currentScript.app=');
expect(content).not.toContain('require("react")');
expect(content).toContain('stylesheet');
expect(content).not.toContain('styles:');
},
});
},
Expand Down

0 comments on commit 7557f5c

Please sign in to comment.