@nymphjs/tilmeld 1.0.0-alpha.1 → 1.0.0-alpha.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/User.test.ts CHANGED
@@ -2,15 +2,9 @@ import { SQLite3Driver } from '@nymphjs/driver-sqlite3';
2
2
  import { Nymph } from '@nymphjs/nymph';
3
3
 
4
4
  import Tilmeld from './Tilmeld';
5
- import User from './User';
6
5
  import defaults from './conf/defaults';
7
6
 
8
- const sqliteConfig = {
9
- filename: ':memory:',
10
- };
11
-
12
- Nymph.init({}, new SQLite3Driver(sqliteConfig), Tilmeld);
13
- Tilmeld.init({
7
+ const tilmeld = new Tilmeld({
14
8
  appName: 'My App',
15
9
  appUrl: 'http://localhost:8080',
16
10
  cookieDomain: 'localhost',
@@ -22,6 +16,15 @@ Tilmeld.init({
22
16
  cancelChangeRedirect: 'http://localhost:8080',
23
17
  jwtSecret: 'shhhhh',
24
18
  });
19
+ const _nymph = new Nymph(
20
+ {},
21
+ new SQLite3Driver({
22
+ filename: ':memory:',
23
+ }),
24
+ tilmeld
25
+ );
26
+
27
+ const User = tilmeld.User;
25
28
 
26
29
  describe('User', () => {
27
30
  async function makeNewUser() {
@@ -37,6 +40,14 @@ describe('User', () => {
37
40
  return newUser;
38
41
  }
39
42
 
43
+ it('new user passes validation', async () => {
44
+ const validUser = await makeNewUser();
45
+
46
+ expect(() => {
47
+ defaults.validatorUser(validUser);
48
+ }).not.toThrow();
49
+ });
50
+
40
51
  it("doesn't allow unknown keys", async () => {
41
52
  const invalidUser = await makeNewUser();
42
53