Skip to content
This repository was archived by the owner on Jul 10, 2025. It is now read-only.

Commit a9bee62

Browse files
author
Akim Mamedov
committed
Add simple test
1 parent 6ba8ea1 commit a9bee62

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+1674
-1628
lines changed

packages/core/aqua-wrapper/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"description": "Tool for generating aqua wrapper",
66
"main": "index.js",
77
"scripts": {
8-
"test": "echo \"Error: no test specified\" && exit 1"
8+
"test": "vitest run"
99
},
1010
"keywords": [],
1111
"author": "Fluence Labs",

packages/core/aqua-wrapper/src/generate/__test__/generate.spec.ts

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,28 @@
1414
* limitations under the License.
1515
*/
1616

17-
import { describe } from 'vitest';
17+
import { describe, expect, it } from 'vitest';
18+
import * as fs from 'fs';
19+
import generate from '../index.js';
20+
import { compileFromPath } from '@fluencelabs/aqua-api';
21+
import * as url from 'url';
1822

1923
describe('Aqua to js/ts compiler', () => {
20-
24+
it('compiles smoke tests successfully', async () => {
25+
const res = await compileFromPath({
26+
filePath: url.fileURLToPath(new URL('./sources/smoke_test.aqua', import.meta.url)),
27+
imports: ['./node_modules'],
28+
targetType: 'air'
29+
});
30+
31+
const jsResult = generate(res, 'js');
32+
const jsSnapshot = fs.readFileSync(new URL('./snapshots/smoke_test.js', import.meta.url))
33+
34+
expect(jsResult).toEqual(jsSnapshot.toString());
35+
36+
const tsResult = generate(res, 'ts');
37+
const tsSnapshot = fs.readFileSync(new URL('./snapshots/smoke_test.ts', import.meta.url))
38+
39+
expect(tsResult).toEqual(tsSnapshot.toString());
40+
});
2141
});

0 commit comments

Comments
 (0)