mirror of https://github.com/AMT-Cheif/drift.git
🚨 Add missing const keywords
This commit is contained in:
parent
1b001e5fa0
commit
26b6fc4203
|
@ -189,7 +189,7 @@ void main() {
|
|||
|
||||
test('updates stream queries', () async {
|
||||
await db.batch((b) {
|
||||
b.insert(db.todosTable, TodoEntry(id: 3, content: 'content'));
|
||||
b.insert(db.todosTable, const TodoEntry(id: 3, content: 'content'));
|
||||
|
||||
b.update(db.users, const UsersCompanion(name: Value('new user name')));
|
||||
b.replace(
|
||||
|
|
|
@ -77,7 +77,7 @@ void main() {
|
|||
});
|
||||
|
||||
test('generated data classes can be converted to companions', () {
|
||||
final entry = Category(
|
||||
const entry = Category(
|
||||
id: 3,
|
||||
description: 'description',
|
||||
priority: CategoryPriority.low,
|
||||
|
@ -97,7 +97,7 @@ void main() {
|
|||
});
|
||||
|
||||
test('data classes can be converted to companions with null to absent', () {
|
||||
final entry = PureDefault(txt: null);
|
||||
const entry = PureDefault(txt: null);
|
||||
|
||||
expect(entry.toCompanion(false),
|
||||
const PureDefaultsCompanion(txt: Value(null)));
|
||||
|
|
|
@ -37,7 +37,7 @@ void main() {
|
|||
});
|
||||
|
||||
test('to delete an entity via a dataclasss', () async {
|
||||
await db.delete(db.sharedTodos).delete(SharedTodo(todo: 3, user: 2));
|
||||
await db.delete(db.sharedTodos).delete(const SharedTodo(todo: 3, user: 2));
|
||||
|
||||
verify(executor.runDelete(
|
||||
'DELETE FROM shared_todos WHERE todo = ? AND user = ?;', [3, 2]));
|
||||
|
|
|
@ -55,7 +55,7 @@ void main() {
|
|||
|
||||
test('generates insert or replace statements', () async {
|
||||
await db.into(db.todosTable).insert(
|
||||
TodoEntry(
|
||||
const TodoEntry(
|
||||
id: 113,
|
||||
content: 'Done',
|
||||
),
|
||||
|
@ -452,7 +452,7 @@ void main() {
|
|||
CategoriesCompanion.insert(description: 'description'));
|
||||
expect(
|
||||
row,
|
||||
Category(
|
||||
const Category(
|
||||
id: 1,
|
||||
description: 'description',
|
||||
descriptionInUpperCase: 'DESCRIPTION',
|
||||
|
@ -503,7 +503,7 @@ void main() {
|
|||
CategoriesCompanion.insert(description: 'description'));
|
||||
expect(
|
||||
row,
|
||||
Category(
|
||||
const Category(
|
||||
id: 1,
|
||||
description: 'description',
|
||||
descriptionInUpperCase: 'DESCRIPTION',
|
||||
|
|
|
@ -72,7 +72,7 @@ void main() {
|
|||
|
||||
expect(
|
||||
row.readTable(categories),
|
||||
Category(
|
||||
const Category(
|
||||
id: 3,
|
||||
description: 'description',
|
||||
priority: CategoryPriority.high,
|
||||
|
@ -107,7 +107,7 @@ void main() {
|
|||
expect(() => row.readTable(db.categories), throwsArgumentError);
|
||||
expect(
|
||||
row.readTable(db.todosTable),
|
||||
TodoEntry(
|
||||
const TodoEntry(
|
||||
id: 5,
|
||||
title: 'title',
|
||||
content: 'content',
|
||||
|
@ -224,7 +224,7 @@ void main() {
|
|||
expect(
|
||||
result.readTable(categories),
|
||||
equals(
|
||||
Category(
|
||||
const Category(
|
||||
id: 3,
|
||||
description: 'Description',
|
||||
descriptionInUpperCase: 'DESCRIPTION',
|
||||
|
@ -274,7 +274,7 @@ void main() {
|
|||
expect(
|
||||
result.readTable(categories),
|
||||
equals(
|
||||
Category(
|
||||
const Category(
|
||||
id: 3,
|
||||
description: 'Description',
|
||||
descriptionInUpperCase: 'DESCRIPTION',
|
||||
|
@ -330,7 +330,7 @@ void main() {
|
|||
expect(result.readTableOrNull(todos), isNull);
|
||||
expect(
|
||||
result.readTable(categories),
|
||||
Category(
|
||||
const Category(
|
||||
id: 3,
|
||||
description: 'desc',
|
||||
descriptionInUpperCase: 'DESC',
|
||||
|
|
|
@ -14,7 +14,7 @@ final _dataOfTodoEntry = {
|
|||
'category': 3
|
||||
};
|
||||
|
||||
final _todoEntry = TodoEntry(
|
||||
const _todoEntry = TodoEntry(
|
||||
id: 10,
|
||||
title: 'A todo title',
|
||||
content: 'Content',
|
||||
|
@ -123,7 +123,7 @@ void main() {
|
|||
'category': null,
|
||||
}
|
||||
];
|
||||
final resolved = TodoEntry(
|
||||
const resolved = TodoEntry(
|
||||
id: 10,
|
||||
title: null,
|
||||
content: 'Content',
|
||||
|
@ -193,7 +193,7 @@ void main() {
|
|||
|
||||
expect(
|
||||
category,
|
||||
Category(
|
||||
const Category(
|
||||
id: 1,
|
||||
description: 'description',
|
||||
descriptionInUpperCase: 'DESCRIPTION',
|
||||
|
|
|
@ -52,7 +52,7 @@ void main() {
|
|||
|
||||
group('generates replace statements', () {
|
||||
test('regular', () async {
|
||||
await db.update(db.todosTable).replace(TodoEntry(
|
||||
await db.update(db.todosTable).replace(const TodoEntry(
|
||||
id: 3,
|
||||
title: 'Title',
|
||||
content: 'Updated content',
|
||||
|
|
|
@ -43,7 +43,7 @@ void main() {
|
|||
final user = db.sharedTodos.mapFromCompanion(companion);
|
||||
expect(
|
||||
user,
|
||||
SharedTodo(todo: 3, user: 4),
|
||||
const SharedTodo(todo: 3, user: 4),
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -58,7 +58,7 @@ void main() {
|
|||
final todo = db.todosTable.mapFromRowOrNull(QueryRow(rowData, db));
|
||||
expect(
|
||||
todo,
|
||||
TodoEntry(
|
||||
const TodoEntry(
|
||||
id: 1,
|
||||
title: 'some title',
|
||||
content: 'do this',
|
||||
|
|
|
@ -69,7 +69,7 @@ void main() {
|
|||
|
||||
test('can be used in a query stream', () async {
|
||||
final stream = db.readView().watch();
|
||||
final entry = Config(
|
||||
const entry = Config(
|
||||
configKey: 'another_key',
|
||||
configValue: 'value',
|
||||
syncState: SyncType.synchronized,
|
||||
|
@ -141,7 +141,7 @@ void main() {
|
|||
expect(result, hasLength(1));
|
||||
expect(
|
||||
result.single,
|
||||
Config(
|
||||
const Config(
|
||||
configKey: 'key2',
|
||||
configValue: 'val',
|
||||
syncState: SyncType.locallyCreated,
|
||||
|
|
|
@ -124,7 +124,7 @@ void main() {
|
|||
|
||||
verify(
|
||||
mock.runSelect('SELECT * FROM config WHERE config_key = ?1', ['key']));
|
||||
expect(parsed, Config(configKey: 'key', configValue: 'value'));
|
||||
expect(parsed, const Config(configKey: 'key', configValue: 'value'));
|
||||
});
|
||||
|
||||
test('applies default parameter expressions when not set', () async {
|
||||
|
@ -167,7 +167,7 @@ void main() {
|
|||
row: QueryRow(row, db),
|
||||
a: 'text for a',
|
||||
b: 42,
|
||||
c: WithConstraint(a: 'text', b: 1337, c: 18.7),
|
||||
c: const WithConstraint(a: 'text', b: 1337, c: 18.7),
|
||||
),
|
||||
);
|
||||
});
|
||||
|
@ -216,7 +216,7 @@ void main() {
|
|||
final entry = await db.readConfig('key').getSingle();
|
||||
expect(
|
||||
entry,
|
||||
Config(
|
||||
const Config(
|
||||
configKey: 'key',
|
||||
configValue: 'value',
|
||||
syncState: SyncType.locallyUpdated,
|
||||
|
|
|
@ -104,7 +104,7 @@ void main() {
|
|||
|
||||
expect(
|
||||
entry,
|
||||
Category(
|
||||
const Category(
|
||||
id: 1,
|
||||
description: 'Description',
|
||||
priority: CategoryPriority.low,
|
||||
|
|
|
@ -14,7 +14,7 @@ void main() {
|
|||
db.select(db.myView).watch(),
|
||||
emitsInOrder([
|
||||
isEmpty,
|
||||
[MyViewData(configKey: 'another', syncState: SyncType.synchronized)]
|
||||
[const MyViewData(configKey: 'another', syncState: SyncType.synchronized)]
|
||||
]),
|
||||
);
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ void main() {
|
|||
final result = await db.todoWithCategoryView.select().getSingle();
|
||||
expect(
|
||||
result,
|
||||
TodoWithCategoryViewData(
|
||||
const TodoWithCategoryViewData(
|
||||
description: 'category description', title: 'title'));
|
||||
});
|
||||
}
|
||||
|
|
|
@ -171,7 +171,7 @@ void _runTests(FutureOr<DriftIsolate> Function() spawner, bool terminateIsolate,
|
|||
|
||||
await expectLater(stream, emits(null));
|
||||
await database.into(database.todosTable).insert(initialCompanion);
|
||||
await expectLater(stream, emits(TodoEntry(id: 1, content: 'my content')));
|
||||
await expectLater(stream, emits(const TodoEntry(id: 1, content: 'my content')));
|
||||
});
|
||||
|
||||
test('can start transactions', () async {
|
||||
|
|
Loading…
Reference in New Issue