mirror of https://github.com/AMT-Cheif/drift.git
Also run tests for moor on chrome and firefox
This commit is contained in:
parent
80a10c73d8
commit
d4cf9c26eb
|
@ -1,2 +1,12 @@
|
||||||
tags:
|
tags:
|
||||||
integration:
|
integration:
|
||||||
|
|
||||||
|
platforms:
|
||||||
|
- vm
|
||||||
|
|
||||||
|
presets:
|
||||||
|
# Only run on browsers when requested. In CI, we only test on browsers when the VM tests went through
|
||||||
|
browsers:
|
||||||
|
platforms:
|
||||||
|
- chrome
|
||||||
|
- firefox
|
|
@ -90,6 +90,8 @@ void main() {
|
||||||
|
|
||||||
verifyNever(executor.runBatched(any));
|
verifyNever(executor.runBatched(any));
|
||||||
verify(executor.transactions.runBatched(any));
|
verify(executor.transactions.runBatched(any));
|
||||||
|
}, onPlatform: const {
|
||||||
|
'js': [Skip('Blocked by https://github.com/dart-lang/mockito/issues/198')]
|
||||||
});
|
});
|
||||||
|
|
||||||
test('updates stream queries', () async {
|
test('updates stream queries', () async {
|
||||||
|
|
|
@ -82,5 +82,7 @@ void main() {
|
||||||
// regression test for https://github.com/simolus3/moor/issues/199 - the
|
// regression test for https://github.com/simolus3/moor/issues/199 - the
|
||||||
// mock will throw when used before opening
|
// mock will throw when used before opening
|
||||||
expect(db.customStatement('UPDATE tbl SET a = b'), completes);
|
expect(db.customStatement('UPDATE tbl SET a = b'), completes);
|
||||||
|
}, onPlatform: const {
|
||||||
|
'js': [Skip('Blocked by https://github.com/dart-lang/mockito/issues/198')]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1190,7 +1190,7 @@ abstract class _$CustomTablesDb extends GeneratedDatabase {
|
||||||
|
|
||||||
Selectable<TableValuedResult> tableValued() {
|
Selectable<TableValuedResult> tableValued() {
|
||||||
return customSelectQuery(
|
return customSelectQuery(
|
||||||
'SELECT\n "key", "value"\n FROM config, json_each(config.config_value)\n WHERE json_valid(config_value)',
|
'SELECT "key", "value"\n FROM config, json_each(config.config_value)\n WHERE json_valid(config_value)',
|
||||||
variables: [],
|
variables: [],
|
||||||
readsFrom: {config}).map(_rowToTableValuedResult);
|
readsFrom: {config}).map(_rowToTableValuedResult);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
@Tags(['integration'])
|
@Tags(['integration'])
|
||||||
|
@TestOn('vm')
|
||||||
import 'package:moor_ffi/moor_ffi.dart';
|
import 'package:moor_ffi/moor_ffi.dart';
|
||||||
import 'package:test/test.dart';
|
import 'package:test/test.dart';
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
@Tags(['integration'])
|
||||||
|
@TestOn('vm')
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import 'package:moor/moor.dart';
|
||||||
|
import 'package:moor/extensions/json1.dart';
|
||||||
|
import 'package:moor_ffi/moor_ffi.dart';
|
||||||
|
import 'package:test/test.dart';
|
||||||
|
|
||||||
|
import '../data/tables/todos.dart';
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
test('json1 integration test', () async {
|
||||||
|
final db = TodoDb(VmDatabase.memory());
|
||||||
|
const jsonObject = {
|
||||||
|
'foo': 'bar',
|
||||||
|
'array': [
|
||||||
|
'one',
|
||||||
|
'two',
|
||||||
|
'three',
|
||||||
|
],
|
||||||
|
};
|
||||||
|
await db
|
||||||
|
.into(db.pureDefaults)
|
||||||
|
.insert(PureDefaultsCompanion(txt: Value(json.encode(jsonObject))));
|
||||||
|
|
||||||
|
final arrayLengthExpr = db.pureDefaults.txt.jsonArrayLength(r'$.array');
|
||||||
|
final query = db.select(db.pureDefaults).addColumns([arrayLengthExpr]);
|
||||||
|
query.where(db.pureDefaults.txt
|
||||||
|
.jsonExtract(r'$.foo')
|
||||||
|
.equalsExp(Variable.withString('bar')));
|
||||||
|
|
||||||
|
final resultRow = await query.getSingle();
|
||||||
|
expect(resultRow.read(arrayLengthExpr), 3);
|
||||||
|
}, tags: const ['integration']);
|
||||||
|
}
|
|
@ -1,11 +1,7 @@
|
||||||
import 'dart:convert';
|
|
||||||
|
|
||||||
import 'package:moor/moor.dart';
|
import 'package:moor/moor.dart';
|
||||||
import 'package:moor/extensions/json1.dart';
|
import 'package:moor/extensions/json1.dart';
|
||||||
import 'package:moor_ffi/moor_ffi.dart';
|
|
||||||
import 'package:test/test.dart';
|
import 'package:test/test.dart';
|
||||||
|
|
||||||
import '../data/tables/todos.dart';
|
|
||||||
import '../data/utils/expect_generated.dart';
|
import '../data/utils/expect_generated.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
|
@ -23,28 +19,4 @@ void main() {
|
||||||
generates('json_extract(col, ?)', [r'$.c']),
|
generates('json_extract(col, ?)', [r'$.c']),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('json1 integration test', () async {
|
|
||||||
final db = TodoDb(VmDatabase.memory());
|
|
||||||
const jsonObject = {
|
|
||||||
'foo': 'bar',
|
|
||||||
'array': [
|
|
||||||
'one',
|
|
||||||
'two',
|
|
||||||
'three',
|
|
||||||
],
|
|
||||||
};
|
|
||||||
await db
|
|
||||||
.into(db.pureDefaults)
|
|
||||||
.insert(PureDefaultsCompanion(txt: Value(json.encode(jsonObject))));
|
|
||||||
|
|
||||||
final arrayLengthExpr = db.pureDefaults.txt.jsonArrayLength(r'$.array');
|
|
||||||
final query = db.select(db.pureDefaults).addColumns([arrayLengthExpr]);
|
|
||||||
query.where(db.pureDefaults.txt
|
|
||||||
.jsonExtract(r'$.foo')
|
|
||||||
.equalsExp(Variable.withString('bar')));
|
|
||||||
|
|
||||||
final resultRow = await query.getSingle();
|
|
||||||
expect(resultRow.read(arrayLengthExpr), 3);
|
|
||||||
}, tags: const ['integration']);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,15 @@
|
||||||
FROM google/dart:latest
|
FROM ubuntu:rolling
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y -q libsqlite3-dev
|
RUN apt-get update && apt-get install -y --no-install-recommends apt-transport-https wget gnupg2 ca-certificates
|
||||||
|
|
||||||
|
# Setup for Dart
|
||||||
|
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
|
||||||
|
RUN wget -qO- https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list
|
||||||
|
|
||||||
|
# Setup for Google Chrome
|
||||||
|
RUN echo 'deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main' | tee /etc/apt/sources.list.d/google-chrome.list
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get install -y --no-install-recommends -q libsqlite3-dev google-chrome-stable firefox dart
|
||||||
|
|
||||||
# We ocassionally have to change this file to manually trigger rebuilds in the CI. Particularly, after a new Dart SDK
|
# We ocassionally have to change this file to manually trigger rebuilds in the CI. Particularly, after a new Dart SDK
|
||||||
# version is out.
|
# version is out.
|
|
@ -1,5 +1,14 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
cd moor
|
EXIT_CODE=0
|
||||||
pub run build_runner test --delete-conflicting-outputs
|
|
||||||
pub run test --coverage=coverage
|
cd moor || exit 1
|
||||||
|
pub run build_runner build --delete-conflicting-outputs
|
||||||
|
|
||||||
|
pub run test --coverage=coverage || EXIT_CODE=$?
|
||||||
|
|
||||||
|
if [ $EXIT_CODE -eq 0 ]
|
||||||
|
then pub run test -P browsers || EXIT_CODE=$?
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit $EXIT_CODE
|
Loading…
Reference in New Issue