|
11 | 11 | import {Manifest} from '../../runtime/manifest.js';
|
12 | 12 | import {StorageKeyRecipeResolver} from '../recipe2plan.js';
|
13 | 13 | import {assert} from '../../platform/chai-node.js';
|
| 14 | +import {assertThrowsAsync} from '../../testing/test-util.js'; |
14 | 15 |
|
15 | 16 | describe('recipe2plan', () => {
|
16 | 17 | it('Long + Long: If ReadingRecipe is long running, it is a valid use case', async () => {
|
@@ -46,9 +47,37 @@ describe('recipe2plan', () => {
|
46 | 47 | for await (const it of resolver.resolve()) {
|
47 | 48 | assert.isTrue(it.isResolved());
|
48 | 49 | }
|
| 50 | + }); |
| 51 | + it('Short + Short: If WritingRecipe is short lived, it is not valid', async () => { |
| 52 | + const manifest = await Manifest.parse(`\ |
| 53 | + particle Reader |
| 54 | + data: reads Thing {name: Text} |
| 55 | +
|
| 56 | + // TODO(alxr): Resolve these types later |
| 57 | + // particle Writer |
| 58 | + // data: writes Product Thing {name: Text, price: Number} |
| 59 | +
|
| 60 | + particle Writer |
| 61 | + data: writes Thing {name: Text} |
| 62 | + |
| 63 | + recipe WritingRecipe |
| 64 | + thing: create persistent 'my-handle-id' |
| 65 | + Writer |
| 66 | + data: writes thing |
| 67 | +
|
| 68 | + recipe ReadingRecipe |
| 69 | + data: map 'my-handle-id' |
| 70 | + Reader |
| 71 | + data: reads data`); |
49 | 72 |
|
| 73 | + await assertThrowsAsync(async () => { |
| 74 | + const resolver = new StorageKeyRecipeResolver(manifest); |
| 75 | + // @ts-ignore |
| 76 | + for await (const it of resolver.resolve()) { |
| 77 | + continue; |
| 78 | + } |
| 79 | + }) |
50 | 80 | });
|
51 |
| - it.skip('Short + Short: If WritingRecipe is short lived, it is not valid', () => {}); |
52 | 81 | it.skip('Short + Long: If WritingRecipe is short lived and Reading is long lived, it is not valid', () => {});
|
53 | 82 | it.skip('Invalid Type: If Reader reads {name: Text, age: Number} it is not valid', () => {});
|
54 | 83 | it.skip('No arc id: If arcId of WritingRecipe is not there, it is not valid', () => {});
|
|
0 commit comments