Skip to content

Commit

Permalink
fix(tests): working directory discrepancy
Browse files Browse the repository at this point in the history
Adjust test files for the latest ava update that changes the working directory for test files.
  • Loading branch information
citycide committed Dec 17, 2016
1 parent 470b48f commit 3330d92
Show file tree
Hide file tree
Showing 18 changed files with 34 additions and 67 deletions.
31 changes: 0 additions & 31 deletions tests/.eslintrc.js

This file was deleted.

4 changes: 2 additions & 2 deletions tests/count.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import Trilogy from '../dist/trilogy'

import test from 'ava'
import { basename } from 'path'
import { remove } from 'fs-jetpack'
import { join, basename } from 'path'

const filePath = `${basename(__filename, '.js')}.db`
const filePath = join(__dirname, `${basename(__filename, '.js')}.db`)
const db = new Trilogy(filePath)

const people = [
Expand Down
4 changes: 2 additions & 2 deletions tests/decrement.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import Trilogy from '../dist/trilogy'

import test from 'ava'
import { basename } from 'path'
import { remove } from 'fs-jetpack'
import { join, basename } from 'path'

const filePath = `${basename(__filename, '.js')}.db`
const filePath = join(__dirname, `${basename(__filename, '.js')}.db`)
const db = new Trilogy(filePath)

const people = [
Expand Down
6 changes: 3 additions & 3 deletions tests/deletions.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import Trilogy from '../dist/trilogy'

import test from 'ava'
import { basename } from 'path'
import { remove } from 'fs-jetpack'
import { join, basename } from 'path'

const filePath = `${basename(__filename, '.js')}.db`
const filePath = join(__dirname, `${basename(__filename, '.js')}.db`)
const db = new Trilogy(filePath)

const somePeople = [
Expand Down Expand Up @@ -43,7 +43,7 @@ test.serial('removes all rows from the specified table', async t => {
await db.del('people')

morePeople.forEach(async ({ name }) => {
const res = await db.first('people', { name })
let res = await db.first('people', { name })
t.falsy(res)
})
})
4 changes: 2 additions & 2 deletions tests/drop-table.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import Trilogy from '../dist/trilogy'

import test from 'ava'
import { basename } from 'path'
import { remove } from 'fs-jetpack'
import { join, basename } from 'path'

const filePath = `${basename(__filename, '.js')}.db`
const filePath = join(__dirname, `${basename(__filename, '.js')}.db`)
const db = new Trilogy(filePath)

const columns = ['name']
Expand Down
Binary file modified tests/existing-file.db
Binary file not shown.
4 changes: 2 additions & 2 deletions tests/existing-file.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import Trilogy from '../dist/trilogy'

import test from 'ava'
import { basename } from 'path'
import { join, basename } from 'path'

const filePath = `${basename(__filename, '.js')}.db`
const filePath = join(__dirname, `${basename(__filename, '.js')}.db`)
const db = new Trilogy(filePath)

test.before('insert default data', async () => {
Expand Down
8 changes: 3 additions & 5 deletions tests/file-creation.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import Trilogy from '../dist/trilogy'

import test from 'ava'
import { join, basename, dirname } from 'path'
import { join, basename } from 'path'
import { exists, remove } from 'fs-jetpack'

const directory = dirname(__filename)
const fileName = `${basename(__filename, '.js')}.db`
const filePath = join(directory, fileName)
const filePath = join(__dirname, `${basename(__filename, '.js')}.db`)

test.after.always('remove test database file', () => remove(filePath))

Expand All @@ -15,7 +13,7 @@ test('throws if no file path is provided', t => {
})

test('successfully creates a new file', t => {
const db = new Trilogy(filePath)
let db = new Trilogy(filePath)
t.is(exists(filePath), 'file')
t.is(db.path, filePath)
})
4 changes: 2 additions & 2 deletions tests/first.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import Trilogy from '../dist/trilogy'

import test from 'ava'
import { basename } from 'path'
import { remove } from 'fs-jetpack'
import { join, basename } from 'path'

const filePath = `${basename(__filename, '.js')}.db`
const filePath = join(__dirname, `${basename(__filename, '.js')}.db`)
const db = new Trilogy(filePath)

test.before(async () => {
Expand Down
4 changes: 2 additions & 2 deletions tests/get-value.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import Trilogy from '../dist/trilogy'

import test from 'ava'
import { basename } from 'path'
import { remove } from 'fs-jetpack'
import { join, basename } from 'path'

const filePath = `${basename(__filename, '.js')}.db`
const filePath = join(__dirname, `${basename(__filename, '.js')}.db`)
const db = new Trilogy(filePath)

test.before(async () => {
Expand Down
4 changes: 2 additions & 2 deletions tests/has-table.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import Trilogy from '../dist/trilogy'

import test from 'ava'
import { basename } from 'path'
import { remove } from 'fs-jetpack'
import { join, basename } from 'path'

const filePath = `${basename(__filename, '.js')}.db`
const filePath = join(__dirname, `${basename(__filename, '.js')}.db`)
const db = new Trilogy(filePath)

const columns = ['name']
Expand Down
4 changes: 2 additions & 2 deletions tests/increment.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import Trilogy from '../dist/trilogy'

import test from 'ava'
import { basename } from 'path'
import { remove } from 'fs-jetpack'
import { join, basename } from 'path'

const filePath = `${basename(__filename, '.js')}.db`
const filePath = join(__dirname, `${basename(__filename, '.js')}.db`)
const db = new Trilogy(filePath)

const people = [
Expand Down
4 changes: 2 additions & 2 deletions tests/inserts.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import Trilogy from '../dist/trilogy'

import test from 'ava'
import { basename } from 'path'
import { remove } from 'fs-jetpack'
import { join, basename } from 'path'

const filePath = `${basename(__filename, '.js')}.db`
const filePath = join(__dirname, `${basename(__filename, '.js')}.db`)
const db = new Trilogy(filePath)

const columns = [
Expand Down
4 changes: 2 additions & 2 deletions tests/issues/boolean-to-string.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import Trilogy from '../../dist/trilogy'

import test from 'ava'
import { basename } from 'path'
import { remove } from 'fs-jetpack'
import { join, basename } from 'path'

const filePath = `${basename(__filename, '.js')}.db`
const filePath = join(__dirname, `${basename(__filename, '.js')}.db`)
const db = new Trilogy(filePath)

test.before(async () => {
Expand Down
4 changes: 2 additions & 2 deletions tests/knex-builders.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import Trilogy from '../dist/trilogy'

import test from 'ava'
import { basename } from 'path'
import { remove } from 'fs-jetpack'
import { join, basename } from 'path'

const filePath = `${basename(__filename, '.js')}.db`
const filePath = join(__dirname, `${basename(__filename, '.js')}.db`)
const db = new Trilogy(filePath)

test.after.always('remove test database file', () => remove(filePath))
Expand Down
4 changes: 2 additions & 2 deletions tests/select.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import Trilogy from '../dist/trilogy'

import test from 'ava'
import { basename } from 'path'
import { remove } from 'fs-jetpack'
import { join, basename } from 'path'

const filePath = `${basename(__filename, '.js')}.db`
const filePath = join(__dirname, `${basename(__filename, '.js')}.db`)
const db = new Trilogy(filePath)

const arr = ['fee', 'fi', 'fo', 'fum']
Expand Down
4 changes: 2 additions & 2 deletions tests/table-creation.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import Trilogy from '../dist/trilogy'

import test from 'ava'
import { basename } from 'path'
import { remove } from 'fs-jetpack'
import { join, basename } from 'path'

const filePath = `${basename(__filename, '.js')}.db`
const filePath = join(__dirname, `${basename(__filename, '.js')}.db`)
const db = new Trilogy(filePath)

test.after.always('remove test database file', () => remove(filePath))
Expand Down
4 changes: 2 additions & 2 deletions tests/updates.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import Trilogy from '../dist/trilogy'

import test from 'ava'
import { basename } from 'path'
import { remove } from 'fs-jetpack'
import { join, basename } from 'path'

const filePath = `${basename(__filename, '.js')}.db`
const filePath = join(__dirname, `${basename(__filename, '.js')}.db`)
const db = new Trilogy(filePath)

test.before(async () => {
Expand Down

0 comments on commit 3330d92

Please sign in to comment.