-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(test): remove tap from drill package
Signed-off-by: mateonunez <mateonunez95@gmail.com>
- Loading branch information
1 parent
2aaed10
commit 31c4145
Showing
9 changed files
with
288 additions
and
1,218 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,18 @@ | ||
import { test } from 'tap' | ||
import { test } from 'node:test' | ||
import assert from 'node:assert' | ||
import { generateConnectionString } from '../lib/database.js' | ||
import huston from '@mateonunez/asterism-huston' | ||
|
||
const { mysqlOptions, postgresOptions } = huston | ||
|
||
test('should generate correctly the connection string', ({ end }) => { | ||
test('mysql', async ({ same }) => { | ||
test('should generate correctly the connection string', async (t) => { | ||
await t.test('mysql', async () => { | ||
const { mysql } = generateConnectionString(mysqlOptions) | ||
same(mysql, 'mysql://root:toor@127.0.0.1:3306/db') | ||
assert.strictEqual(mysql, 'mysql://root:toor@127.0.0.1:3306/db') | ||
}) | ||
|
||
test('postgres', async ({ same }) => { | ||
await t.test('postgres', async () => { | ||
const { postgres } = generateConnectionString(postgresOptions) | ||
same(postgres, 'postgres://postgres:toor@127.0.0.1:5432/db') | ||
assert.strictEqual(postgres, 'postgres://postgres:toor@127.0.0.1:5432/db') | ||
}) | ||
|
||
end() | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,21 @@ | ||
import { test } from 'tap' | ||
import { test } from 'node:test' | ||
import assert from 'node:assert' | ||
import setupDatabase from '../drill.js' | ||
|
||
test('should throw an error when the database is not support', async ({ ok }) => { | ||
try { | ||
test('should rejects with error when the database is not support', async () => { | ||
assert.rejects(async () => { | ||
await setupDatabase(null, 'oracle', {}) | ||
} catch (err) { | ||
ok(err) | ||
} | ||
}, { | ||
name: 'Error', | ||
message: 'The database "oracle" is not supported.' | ||
}) | ||
}) | ||
|
||
test('should throw an error when the parameters are wront', async ({ ok }) => { | ||
try { | ||
test('should reject with error when the parameters are wrong', async () => { | ||
assert.rejects(async () => { | ||
await setupDatabase(null, 'mysql', { user: 'fake', password: 'kaboom' }) | ||
} catch (err) { | ||
ok(err) | ||
} | ||
}, { | ||
name: 'Error', | ||
message: /Could not connect to mysql database at/ | ||
}) | ||
}) |
Oops, something went wrong.