Skip to content

Commit

Permalink
Merge pull request #52 from divyenduz/fix_tests
Browse files Browse the repository at this point in the history
fix(tests): after jsdoc refactor
  • Loading branch information
divyenduz authored Jun 13, 2024
2 parents 3c47118 + e1dcac7 commit cfe1bb3
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 23 deletions.
Binary file modified bun.lockb
Binary file not shown.
27 changes: 21 additions & 6 deletions src/impl/PLV8ifyCLI.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@ describe('PLV8ifyCLI tests', () => {
const sql = plv8ify.getPLV8SQLFunction({
fn: {
name: 'test',
isExported: true,
parameters: [],
comments: [],
} as TSFunction,
returnType: 'void',
jsdocTags: []
},
scopePrefix: 'plv8ify_',
mode: 'inline',
defaultVolatility: 'IMMUTABLE',
Expand All @@ -22,14 +25,17 @@ describe('PLV8ifyCLI tests', () => {
expect(sql).toMatchSnapshot()
})

it('getSQLFunction with delimiter', async () => {
it('getSQLFunction with custom delimiter', async () => {
const plv8ify = new PLV8ifyCLI()
const sql = plv8ify.getPLV8SQLFunction({
fn: {
name: 'test',
isExported: true,
parameters: [],
comments: [],
} as TSFunction,
returnType: 'void',
jsdocTags: [],
},
scopePrefix: 'plv8ify_',
mode: 'inline',
defaultVolatility: 'IMMUTABLE',
Expand All @@ -46,12 +52,15 @@ describe('PLV8ifyCLI tests', () => {
const sql = plv8ify.getPLV8SQLFunction({
fn: {
name: 'test',
isExported: true,
parameters: [
{ name: 'NEW', type: 'testRow' },
{ name: 'OLD', type: 'testRow' },
],
comments: ['//@plv8ify-trigger'],
} as TSFunction,
returnType: 'object',
jsdocTags: []
},
scopePrefix: 'plv8ify_',
mode: 'inline',
defaultVolatility: 'IMMUTABLE',
Expand All @@ -78,9 +87,12 @@ function test(NEW, OLD) {
const sql = plv8ify.getPLV8SQLFunction({
fn: {
name: 'test',
isExported: true,
parameters: [],
comments: ['//@plv8ify-schema-name testschema'],
} as TSFunction,
returnType: 'string',
jsdocTags: []
},
scopePrefix: 'plv8ify_',
mode: 'inline',
defaultVolatility: 'IMMUTABLE',
Expand All @@ -102,9 +114,12 @@ function test() {
const sql = plv8ify.getPLV8SQLFunction({
fn: {
name: 'test',
isExported: true,
parameters: [{ name: 'test', type: 'test_type[]' }],
comments: [],
} as TSFunction,
returnType: 'object',
jsdocTags: []
},
scopePrefix: '',
mode: 'inline',
defaultVolatility: 'IMMUTABLE',
Expand Down
16 changes: 2 additions & 14 deletions src/impl/__snapshots__/EsBuild.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ export {
"
`;
exports[`EsBuild tests getBundleJs - bad syntax 1`] = `[BundlerError: esbuild failed]`;
exports[`EsBuild tests getBundleJs - newline template 1`] = `
"// src/test-fixtures/newline-template.fixture.ts
function sayHello() {
Expand All @@ -36,17 +38,3 @@ export {
};
"
`;
exports[`EsBuild tests getBundleJs - newline string 2`] = `
"// src/test-fixtures/newline-string.fixture.ts
function sayHello() {
const greetString = "hello\nworld";
return greetString;
}
export {
sayHello
};
"
`;
exports[`EsBuild tests getBundleJs - bad syntax 1`] = `[BundlerError: esbuild failed]`;
5 changes: 2 additions & 3 deletions src/impl/__snapshots__/PLV8ifyCLI.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ return test()
$plv8ify$ LANGUAGE plv8 IMMUTABLE STRICT;"
`;

exports[`PLV8ifyCLI tests getSQLFunction with delimiter 1`] = `
exports[`PLV8ifyCLI tests getSQLFunction with custom delimiter 1`] = `
"DROP FUNCTION IF EXISTS plv8ify_test();
CREATE OR REPLACE FUNCTION plv8ify_test() RETURNS JSONB AS $function$
console.log('hello')
Expand All @@ -18,7 +18,6 @@ return test()
$function$ LANGUAGE plv8 IMMUTABLE STRICT;"
`;


exports[`PLV8ifyCLI tests getSQLFunction with parameters-trigger 1`] = `
"DROP FUNCTION IF EXISTS plv8ify_test();
CREATE OR REPLACE FUNCTION plv8ify_test() RETURNS TRIGGER AS $plv8ify$
Expand All @@ -41,7 +40,7 @@ $plv8ify$ LANGUAGE plv8 IMMUTABLE STRICT;"

exports[`PLV8ifyCLI tests getSQLFunction with custom-schema 1`] = `
"DROP FUNCTION IF EXISTS testschema.plv8ify_test();
CREATE OR REPLACE FUNCTION testschema.plv8ify_test() RETURNS JSONB AS $plv8ify$
CREATE OR REPLACE FUNCTION testschema.plv8ify_test() RETURNS text AS $plv8ify$
function test() {
return "hello";
Expand Down

0 comments on commit cfe1bb3

Please sign in to comment.