Skip to content
This repository has been archived by the owner on Jun 24, 2024. It is now read-only.

Commit

Permalink
test: fix env dependent snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
digitalsadhu committed Dec 4, 2017
1 parent bc7d3bf commit 8ef21a8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
6 changes: 0 additions & 6 deletions test/__snapshots__/sink.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@ exports[`.reader() - read existing file - should stream read file 1`] = `"feed.a

exports[`.reader() - read existing file - should stream read file 2`] = `661328`;

exports[`.set() - should not set value if missing value 1`] = `[AssertionError [ERR_ASSERTION]: "fileContent" is missing]`;

exports[`.set() - should not set value if missing value 2`] = `[Error: No file could be located with name "some-key-1". ENOENT: no such file or directory, open '/var/folders/bn/3rfyg5tn14sgpvl5jh92l709fmg1vs/T/set-2-rand-26603/some-key-1']`;

exports[`.set() - should set value 1`] = `[Error: No file could be located with name "some-key". ENOENT: no such file or directory, open '/var/folders/bn/3rfyg5tn14sgpvl5jh92l709fmg1vs/T/get-1-rand-73788/some-key']`;

exports[`.writer() - on "file saved" - should have "id" and "file" on emitted event 1`] = `"07a109ac983bc28d7f393215ca409e2d759e1fda9dc034e48338a5ef1aa92d6c"`;

exports[`.writer() - on "file saved" - should have "id" and "file" on emitted event 2`] = `"07a109ac983bc28d7f393215ca409e2d759e1fda9dc034e48338a5ef1aa92d6c.json"`;
Expand Down
14 changes: 10 additions & 4 deletions test/sink.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,12 @@ test('constructor() - has value for "options.path" argument - should be of Sink

test('.get() - non value should error', async () => {
const sink = getFreshSink('get-1');
expect(sink.get('some-key')).rejects.toMatchSnapshot();
try {
await sink.get('some-key');
} catch (err) {
expect(err.message).toMatch(/No file could be located with name/);
expect(err.message).toMatch(/ENOENT: no such file or directory/);
}
});

test('.set() - should set value', async () => {
Expand All @@ -53,19 +58,20 @@ test('.set() - should set a deep folder', async () => {
});

test('.set() - should not set value if missing value', async () => {
expect.assertions(2);
expect.assertions(3);
const sink = getFreshSink('set-2');

try {
await sink.set('some-key-1');
} catch (e) {
expect(e).toMatchSnapshot();
expect(e.message).toMatch(/"fileContent" is missing/);
}

try {
await sink.get('some-key-1');
} catch (e) {
expect(e).toMatchSnapshot();
expect(e.message).toMatch(/No file could be located with name/);
expect(e.message).toMatch(/ENOENT: no such file or directory/);
}
});

Expand Down

0 comments on commit 8ef21a8

Please sign in to comment.