• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

nicholaswmin / automap / 9927329623

14 Jul 2024 10:35AM UTC coverage: 92.3%. Remained the same
9927329623

push

github

Nicholas Kyriakides
docs: fix wrong example

511 of 523 branches covered (97.71%)

Branch coverage included in aggregate %.

2186 of 2399 relevant lines covered (91.12%)

24.04 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

86.27
/test/unit/repository/fetch/fetch.spec.js
1
import assert from 'node:assert'
1✔
2
import { test } from 'node:test'
1✔
3
import ioredis from 'ioredis-mock'
1✔
4

1✔
5
import { Repository } from '../../../../src/repository.js'
1✔
6
import { Chatroom } from '../../../helpers/model/index.js'
1✔
7

1✔
8
test('Repository', async t => {
1✔
9
  let repo, fetched
1✔
10

1✔
11
  await t.test('#fetch', async t => {
1✔
12
    await t.beforeEach(() => {
1✔
13
      repo = new Repository(Chatroom, new ioredis())
10✔
14
    })
1✔
15

1✔
16
    await t.test('no parameter object is passed', async t => {
1✔
17
      await t.test('rejects with error', async () => {
1✔
18
        await assert.rejects(
1✔
19
          async () => {
1✔
20
            await repo.fetch({ foo: 'bar' })
1!
21
          }
1✔
22
        )
1✔
23
      })
1✔
24
    })
1✔
25

1✔
26
    await t.test('no "id" is passed in parameter object', async t => {
1✔
27
      await t.test('rejects with error', async () => {
1✔
28
        await assert.rejects(
1✔
29
          async () => {
1✔
30
            await repo.fetch({ foo: 'bar' })
1!
31
          }
1✔
32
        )
1✔
33
      })
1✔
34
    })
1✔
35

1✔
36
    await t.test('passed "id" is an empty string', async t => {
1✔
37
      await t.test('rejects with error', async () => {
1✔
38
        await assert.rejects(
1✔
39
          async () => {
1✔
40
            await repo.fetch({ id: '' })
1!
41
          }
1✔
42
        )
1✔
43
      })
1✔
44
    })
1✔
45

1✔
46
    await t.test('passed "id" is a valid string', async t => {
1✔
47
      await t.test('resolves', async () => {
1✔
48
        await assert.doesNotReject(
1✔
49
          async () => {
1✔
50
            await repo.fetch({ id: 'ciBr8Y' })
1✔
51
          }
1✔
52
        )
1✔
53
      })
1✔
54
    })
1✔
55

1✔
56
    await t.test('passed "id" does not exist', async t => {
1✔
57
      await t.beforeEach(async () => {
1✔
58
        fetched = await repo.fetch({ id: 'non-existent-id' })
1✔
59
      })
1✔
60

1✔
61
      await t.test('resolves with null', async () => {
1✔
62
        assert.ok(fetched === null, 'result is null')
1✔
63
      })
1✔
64
    })
1✔
65

1✔
66
    await t.todo('passed "id" exists', async t => {
1✔
67
      await t.beforeEach(async () => {
×
68
        await repo.save(new Chatroom({ id: 'foo' }))
×
69

×
70
        fetched = await repo.fetch({ id: 'foo' })
×
71
      })
×
72

×
73
      await t.test('resolves with hydrated instance', async () => {
×
74
        // @TODO
×
75
        // throws `hashes.map is not a function`, maybe because `ioredis-mock`
×
76
        console.log(fetched)
×
77
      })
×
78
    })
1✔
79
  })
1✔
80
})
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc