smartinject/test/test.ts

37 lines
976 B
TypeScript
Raw Normal View History

2019-02-24 22:11:26 +00:00
import { tap, expect } from '@pushrocks/tapbundle';
2017-02-28 22:40:13 +00:00
2019-02-24 22:11:26 +00:00
import * as path from 'path';
2017-02-28 22:40:13 +00:00
2019-02-24 22:11:26 +00:00
import * as smartinject from '../ts/index';
2017-02-28 22:40:13 +00:00
2017-07-28 16:19:06 +00:00
tap.test('should inject a file using fileArray', async () => {
return smartinject.injectFileArray([
{
path: path.join(__dirname, 'hi.js'),
contents: new Buffer(
`require('./hi2.js')
require('through2')
2017-02-28 22:40:13 +00:00
console.log('this console comment was injected')
2019-02-24 22:11:26 +00:00
`
)
2017-07-28 16:19:06 +00:00
}
2019-02-24 22:11:26 +00:00
]);
});
2017-02-28 22:40:13 +00:00
2017-07-28 16:19:06 +00:00
tap.test('should log hi to console', async () => {
2019-02-24 22:11:26 +00:00
require(path.join(__dirname, 'hi.js'));
});
tap.test('should get a string for a filePath from a .js file', async () => {
let fileString = smartinject.getFileString(path.join(__dirname, 'hi.js'));
console.log(fileString);
});
2019-02-24 22:14:47 +00:00
tap.test('should accept a typescript registration', async () => {});
2017-07-28 16:19:06 +00:00
2019-02-24 22:11:26 +00:00
tap.test('should get a string for a file path from a .ts file', async () => {
let fileString = smartinject.getFileString(path.join(__dirname, 'typescript.example.ts'));
2019-02-24 22:14:47 +00:00
});
2017-07-30 20:00:20 +00:00
2019-02-24 22:11:26 +00:00
tap.start();