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

nicholaswmin / automap / 10227238309

03 Aug 2024 10:16AM UTC coverage: 94.947%. Remained the same
10227238309

Pull #29

github

web-flow
Merge a50c6bcca into a2bd0b724
Pull Request #29: [dyno] feat: streamline benchmarking

510 of 521 branches covered (97.89%)

Branch coverage included in aggregate %.

2177 of 2309 relevant lines covered (94.28%)

27.01 hits per line

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

85.06
/test/unit/repository/fetch/fetch.test.js
1
import test from 'node:test'
1✔
2
import ioredis from 'ioredis-mock'
1✔
3

1✔
4
import { Repository } from '../../../../src/repository.js'
1✔
5
import { Building } from '../../../util/model/index.js'
1✔
6

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

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

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

1✔
25
    await t.test('passed "id" is an empty string', async t => {
1✔
26
      await t.test('rejects with error', async () => {
1✔
27
        await t.assert.rejects(
1✔
28
          async () => {
1✔
29
            await repo.fetch('')
1!
30
          }
1✔
31
        )
1✔
32
      })
1✔
33
    })
1✔
34

1✔
35
    await t.test('passed "id" is a valid string', async t => {
1✔
36
      await t.test('resolves', async () => {
1✔
37
        await t.assert.doesNotReject(
1✔
38
          async () => {
1✔
39
            await repo.fetch('ciBr8Y')
1✔
40
          }
1✔
41
        )
1✔
42
      })
1✔
43
    })
1✔
44

1✔
45
    await t.test('passed "id" does not exist', async t => {
1✔
46
      t.beforeEach(async () => {
1✔
47
        fetched = await repo.fetch('non-existent-id')
1✔
48
      })
1✔
49

1✔
50
      await t.test('resolves with null', async () => {
1✔
51
        t.assert.ok(fetched === null, 'result is null')
1✔
52
      })
1✔
53
    })
1✔
54

1✔
55
    t.todo('passed "id" exists', async t => {
1✔
56
      t.beforeEach(async () => {
×
57
        await repo.save(new Building({ id: 'foo' }))
×
58

×
59
        fetched = await repo.fetch('foo')
×
60
      })
×
61

×
62
      await t.test('resolves with hydrated instance', async () => {
×
63
        // @TODO
×
64
        // throws `hashes.map is not a function`, maybe because `ioredis-mock`
×
65
        console.log(fetched)
×
66
      })
×
67
    })
1✔
68
  })
1✔
69
})
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