Skip to content

Commit f598d94

Browse files
Added API compatibility test
1 parent b444e1c commit f598d94

File tree

4 files changed

+29
-2
lines changed

4 files changed

+29
-2
lines changed

test/compatibility_tests.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import quicksql from '../dist/quick-sql.js';
2+
3+
function assert( condition ) {
4+
if( !eval(condition) ) {
5+
console.error("Failed: "+condition);
6+
throw new Error('Test failed');
7+
}
8+
}
9+
10+
export default function compatibility_tests() {
11+
12+
input = `dept
13+
name
14+
`
15+
output = JSON.stringify(quicksql.toERD(input), null, 4);
16+
assert( "0 < output.indexOf('dept')" );
17+
18+
input = `dept
19+
name
20+
`
21+
output = quicksql.toDDL(input);
22+
assert( "0 < output.indexOf('dept')" );
23+
}
24+

test/diagram_tests.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export default function diagram_tests() {
2828
emp
2929
name
3030
`
31-
output = JSON.stringify(toERD(input,opt), null, 4); // legacy compatibility
31+
output = JSON.stringify(toERD(input,opt), null, 4); // 1.1.5 compatibility
3232
//console.log(output);
3333

3434
assert( "0 < output.indexOf('prefix_dept')" );

test/regression_test.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,9 @@ function processFile( subdir, file ) {
142142

143143
let t1 = Date.now();
144144

145+
import compatibility_tests from './compatibility_tests.js'
146+
console.log('compatibility_tests.js');
147+
145148
import small_tests from './small_tests.js'
146149
console.log('small_tests.js');
147150

test/small_tests.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ var output1;
1212

1313
export default function small_tests() {
1414

15-
output = toDDL( // backward compatible but deprecated function call
15+
output = toDDL( // 1.1.5 compatible but deprecated function call
1616
`departments
1717
name
1818
# settings = {"prefix": "RIGHT"}

0 commit comments

Comments
 (0)