Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Avatar for KuCalc : devops.
Download
50640 views
1
###############################################################################
2
#
3
# CoCalc: Collaborative web-based calculation
4
# Copyright (C) 2017, Sagemath Inc.
5
# AGPLv3
6
#
7
###############################################################################
8
9
###
10
Test functionality in the client module.
11
###
12
13
client = require('../client')
14
expect = require('expect')
15
16
describe 'test password checking -- ', ->
17
it 'inputs a valid password', ->
18
expect(client.is_valid_password('foobar')).toEqual([true, ''])
19
20
it 'inputs nothing', ->
21
expect(client.is_valid_password()).toEqual([false, 'Password must be specified.'])
22
23
it 'inputs an object', ->
24
expect(client.is_valid_password({foo:'bar'})).toEqual([false, 'Password must be specified.'])
25
26
it 'inputs something too short', ->
27
expect(client.is_valid_password('barxx')).toEqual([false, 'Password must be between 6 and 64 characters in length.'])
28
29
it 'inputs something too long', ->
30
s = ('x' for _ in [0..65]).join('')
31
expect(client.is_valid_password(s)).toEqual([false, 'Password must be between 6 and 64 characters in length.'])
32
33
34
35