@@ -28,14 +28,14 @@ defmodule SqlitexTest do
28
28
test "server basic query" do
29
29
{ :ok , conn } = Sqlitex.Server . start_link ( @ shared_cache )
30
30
{ :ok , [ row ] } = Sqlitex.Server . query ( conn , "SELECT * FROM players ORDER BY id LIMIT 1" )
31
- assert row == [ id: 1 , name: "Mikey" , created_at: { { 2012 , 10 , 14 } , { 05 , 46 , 28 , 318_107 } } , updated_at: { { 2013 , 09 , 06 } , { 22 , 29 , 36 , 610_911 } } , type: nil ]
31
+ assert row == [ id: 1 , name: "Mikey" , created_at: { { 2012 , 10 , 14 } , { 05 , 46 , 28 , 318_107 } } , updated_at: { { 2013 , 09 , 06 } , { 22 , 29 , 36 , 610_911 } } , type: nil ]
32
32
Sqlitex.Server . stop ( conn )
33
33
end
34
34
35
35
test "server basic query by name" do
36
36
{ :ok , _ } = Sqlitex.Server . start_link ( @ shared_cache , name: :sql )
37
37
{ :ok , [ row ] } = Sqlitex.Server . query ( :sql , "SELECT * FROM players ORDER BY id LIMIT 1" )
38
- assert row == [ id: 1 , name: "Mikey" , created_at: { { 2012 , 10 , 14 } , { 05 , 46 , 28 , 318_107 } } , updated_at: { { 2013 , 09 , 06 } , { 22 , 29 , 36 , 610_911 } } , type: nil ]
38
+ assert row == [ id: 1 , name: "Mikey" , created_at: { { 2012 , 10 , 14 } , { 05 , 46 , 28 , 318_107 } } , updated_at: { { 2013 , 09 , 06 } , { 22 , 29 , 36 , 610_911 } } , type: nil ]
39
39
Sqlitex.Server . stop ( :sql )
40
40
end
41
41
@@ -46,20 +46,20 @@ defmodule SqlitexTest do
46
46
47
47
test "a basic query returns a list of keyword lists" , context do
48
48
{ :ok , [ row ] } = Sqlitex . query ( context [ :golf_db ] , "SELECT * FROM players ORDER BY id LIMIT 1" )
49
- assert row == [ id: 1 , name: "Mikey" , created_at: { { 2012 , 10 , 14 } , { 05 , 46 , 28 , 318_107 } } , updated_at: { { 2013 , 09 , 06 } , { 22 , 29 , 36 , 610_911 } } , type: nil ]
49
+ assert row == [ id: 1 , name: "Mikey" , created_at: { { 2012 , 10 , 14 } , { 05 , 46 , 28 , 318_107 } } , updated_at: { { 2013 , 09 , 06 } , { 22 , 29 , 36 , 610_911 } } , type: nil ]
50
50
end
51
51
52
52
test "a basic query returns a list of maps when into: %{} is given" , context do
53
53
{ :ok , [ row ] } = Sqlitex . query ( context [ :golf_db ] , "SELECT * FROM players ORDER BY id LIMIT 1" , into: % { } )
54
- assert row == % { id: 1 , name: "Mikey" , created_at: { { 2012 , 10 , 14 } , { 05 , 46 , 28 , 318_107 } } , updated_at: { { 2013 , 09 , 06 } , { 22 , 29 , 36 , 610_911 } } , type: nil }
54
+ assert row == % { id: 1 , name: "Mikey" , created_at: { { 2012 , 10 , 14 } , { 05 , 46 , 28 , 318_107 } } , updated_at: { { 2013 , 09 , 06 } , { 22 , 29 , 36 , 610_911 } } , type: nil }
55
55
end
56
56
57
57
test "with_db" do
58
58
{ :ok , [ row ] } = Sqlitex . with_db ( @ shared_cache , fn ( db ) ->
59
59
Sqlitex . query ( db , "SELECT * FROM players ORDER BY id LIMIT 1" )
60
60
end )
61
61
62
- assert row == [ id: 1 , name: "Mikey" , created_at: { { 2012 , 10 , 14 } , { 05 , 46 , 28 , 318_107 } } , updated_at: { { 2013 , 09 , 06 } , { 22 , 29 , 36 , 610_911 } } , type: nil ]
62
+ assert row == [ id: 1 , name: "Mikey" , created_at: { { 2012 , 10 , 14 } , { 05 , 46 , 28 , 318_107 } } , updated_at: { { 2013 , 09 , 06 } , { 22 , 29 , 36 , 610_911 } } , type: nil ]
63
63
end
64
64
65
65
test "table creation works as expected" do
0 commit comments