-
Notifications
You must be signed in to change notification settings - Fork 882
/
ClauseSpec.js
44 lines (36 loc) · 1.41 KB
/
ClauseSpec.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import Clause from "../../../src/languageProcessing/values/Clause.js";
describe( "creates a Clause", function() {
const mockClause = new Clause( "The cat is loved.", [ "is" ] );
it( "tests the constructor", () => {
expect( mockClause._clauseText ).toEqual( "The cat is loved." );
expect( mockClause._auxiliaries ).toEqual( [ "is" ] );
expect( mockClause._isPassive ).toEqual( false );
expect( mockClause._participles ).toEqual( [] );
} );
it( "returns the text of the clause", function() {
expect( mockClause.getClauseText() ).toBe( "The cat is loved." );
} );
it( "returns the auxiliaries of the clause", function() {
expect( mockClause.getAuxiliaries() ).toEqual( [ "is" ] );
} );
it( "returns whether the sentence is passive", function() {
mockClause.setPassive( true );
expect( mockClause.isPassive() ).toBe( true );
} );
it( "returns the participles", function() {
mockClause.setParticiples( [ "loved" ] );
expect( mockClause.getParticiples() ).toEqual( [ "loved" ] );
} );
} );
describe( "a test for serializing and parsing a Clause class instance", function() {
const mockClause = new Clause( "The cat is loved.", [ "is" ] );
it( "serializes and parses an instance of the Clause class.", function() {
expect( mockClause.serialize() ).toEqual( {
_parseClass: "Clause",
clauseText: "The cat is loved.",
auxiliaries: [ "is" ],
isPassive: false,
participles: [],
} );
} );
} );