Skip to content

Commit

Permalink
style(loader): rename to fauda
Browse files Browse the repository at this point in the history
  • Loading branch information
ngryman committed Nov 17, 2020
1 parent 02da5f5 commit 21541c9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
10 changes: 5 additions & 5 deletions src/loader.spec.ts → src/fauda.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { TestProject } from '../test/utils/testProject'
import { load } from './loader'
import { fauda } from './fauda'
import { FaudaOptions } from './types'

describe('given a JSON schema', () => {
Expand All @@ -13,7 +13,7 @@ describe('given a JSON schema', () => {
NODE_ENV: 'development'
}
}
const configuration = await load(
const configuration = await fauda(
'pasta',
'test/fixtures/schema.json',
options
Expand All @@ -40,7 +40,7 @@ describe('given a JSON schema', () => {
cwd: '',
env: {}
}
const config = await load('pasta', 'test/fixtures/schema.json', options)
const config = await fauda('pasta', 'test/fixtures/schema.json', options)
expect(config).toMatchInlineSnapshot(`
Object {
"cookingTime": 200,
Expand All @@ -63,7 +63,7 @@ describe('given a JSON schema', () => {
cwd: testProject.rootDir,
env: {}
}
const config = await load('pasta', 'test/fixtures/schema.json', options)
const config = await fauda('pasta', 'test/fixtures/schema.json', options)
expect(config).toMatchInlineSnapshot(`
Object {
"cookingTime": 200,
Expand All @@ -83,7 +83,7 @@ describe('given a JSON schema', () => {

describe('given invalid arguments', () => {
it('throws an error if the schema does not exists', async () => {
await expect(() => load('pasta', '/the/void')).rejects
await expect(() => fauda('pasta', '/the/void')).rejects
.toThrowErrorMatchingInlineSnapshot(`
"load: Error loading schema
ENOENT: no such file or directory, open '/the/void'"
Expand Down
6 changes: 1 addition & 5 deletions src/loader.ts → src/fauda.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,7 @@ async function loadFromAll(
return mergedConfig
}

/**
* Loads configuration, from environment variables, command-line arguments,
* and configuration files.
*/
export async function load<Configuration>(
export async function fauda<Configuration>(
namespace: string,
schema: string | JsonObject,
options: Partial<FaudaOptions> = {}
Expand Down

0 comments on commit 21541c9

Please # to comment.