-
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.
- Loading branch information
1 parent
8038b49
commit 3c73865
Showing
10 changed files
with
239 additions
and
111 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
File renamed without changes.
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { CHINOOK_DATABASE_URL } from '../../../test/shared' | ||
import { SQLiteCloudClient } from '../SQLiteCloudClient' | ||
|
||
const DEFAULT_TABLE_NAME = 'albums'; | ||
|
||
const client = new SQLiteCloudClient(CHINOOK_DATABASE_URL) | ||
|
||
describe('SQLiteCloudClient test suite', () => { | ||
it('should be able to create a client', () => { | ||
expect(client).toBeDefined() | ||
expect(client).toBeInstanceOf(SQLiteCloudClient) | ||
}) | ||
|
||
it('should throw errors if no valid params are provided', () => { | ||
expect(() => new SQLiteCloudClient('')).toThrow() | ||
expect(() => new SQLiteCloudClient({ connectionString: '' })).toThrow() | ||
expect(() => new SQLiteCloudClient({ connectionString: 'invalid' })).toThrow() | ||
Check failure Code scanning / CodeQL Hard-coded credentials Critical test
The hard-coded value "invalid" is used as
authorization header Error loading related location Loading |
||
}) | ||
|
||
it('should be able to query the database', async () => { | ||
const { data, error } = await client.sql`SELECT * FROM ${DEFAULT_TABLE_NAME}`; | ||
|
||
expect(data).toBeDefined() | ||
expect(error).toBeNull() | ||
}) | ||
|
||
}) |
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,37 @@ | ||
import { expect } from '@jest/globals' | ||
import { StorageClient } from '../storage/StorageClient' | ||
import { StorageClient } from '../_storage/StorageClient' | ||
import { CHINOOK_DATABASE_URL } from '../../../test/shared' | ||
|
||
const TEST_BUCKET_NAME = 'test_bucket' | ||
|
||
const storage = new StorageClient(CHINOOK_DATABASE_URL) | ||
const storage = new StorageClient(CHINOOK_DATABASE_URL, | ||
{ | ||
headers: { | ||
'Content-Type': 'application/json' | ||
} | ||
} | ||
) | ||
|
||
describe('StorageClient', () => { | ||
it('should be able to create a bucket', async () => { | ||
expect(storage).toBeDefined() | ||
const getBucketResponse = await storage.getBucket(TEST_BUCKET_NAME) | ||
console.log(getBucketResponse) | ||
|
||
const bucket = await storage.createBucket('test-bucket') | ||
|
||
expect(bucket).toBeDefined() | ||
const { data, error } = await storage.createBucket(TEST_BUCKET_NAME) | ||
console.log(data, error) | ||
expect(error).toBeNull() | ||
expect(data).toBeDefined() | ||
}) | ||
}) | ||
|
||
it('should get a bucket', async () => { | ||
expect(storage).toBeDefined() | ||
|
||
const { data, error } = await storage.getBucket(TEST_BUCKET_NAME) | ||
console.log(data) | ||
expect(error).toBeNull() | ||
expect(data).toBeDefined() | ||
}) | ||
|
||
|
||
}) |
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
Oops, something went wrong.